Fix location of sizeof/alignof (PR c++/80016)
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 24 Apr 2017 19:12:52 +0000 (19:12 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 24 Apr 2017 19:12:52 +0000 (19:12 +0000)
commit412f61f0f6ee495f3dd076debd9db536aa386a26
treec526d0dafa94cbbde49da875a81aa5371bb35d73
parenta8492d5ec1d8b90930a7dca04a104bcaec62d035
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.

From-SVN: r247108
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C