https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80016

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Mon Apr 24 19:12:52 2017
New Revision: 247108

URL: https://gcc.gnu.org/viewcvs?rev=247108&root=gcc&view=rev
Log:
Fix location of sizeof/alignof (PR c++/80016)

PR c++/80016 reports an issue with bizarre underlined range
for a complicated expression.

The root cause for the incorrect *starting* location of that range
is that alignof and sizeof expressions currently have
start == finish == caret at the opening parenthesis of the
expression.

This patch fixes this by generating appropriate start and finish
locations for alignof and sizeof expressions.

gcc/cp/ChangeLog:
        PR c++/80016
        * parser.c (cp_parser_unary_expression):  Generate a location
        range for alignof and sizeof expressions.

gcc/testsuite/ChangeLog:
        PR c++/80016
        * g++.dg/plugin/diagnostic-test-expressions-1.C (test_sizeof): New
        test function.
        (test_alignof): New test function.


Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C

Reply via email to