Fix location of sizeof/alignof (PR c++/80016)
commit35f228e425a9d294fd09cac29ae9dc645f5f400c
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Apr 2017 19:12:52 +0000 (24 19:12 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 24 Apr 2017 19:12:52 +0000 (24 19:12 +0000)
treec526d0dafa94cbbde49da875a81aa5371bb35d73
parentc487041b00e193f5db2b5372c8fecaf11d4ee71b
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247108 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C