c++: Report invalid id-expression in decltype [PR100482]
commita90bd3ea6d1ba27b15476f0a768d7952c6723420
authorNathaniel Shead <nathanieloshead@gmail.com>
Tue, 8 Aug 2023 02:48:43 +0000 (8 12:48 +1000)
committerJason Merrill <jason@redhat.com>
Tue, 8 Aug 2023 20:03:25 +0000 (8 16:03 -0400)
tree2701dd6bf11608f0088a1d373b0cb9b9c88f774a
parente7cae4f873fe94c1af8401b8d0b53a192957215d
c++: Report invalid id-expression in decltype [PR100482]

This patch ensures that any errors raised by finish_id_expression when
parsing a decltype expression are properly reported, rather than
potentially going ignored and causing invalid code to be accepted.

We can also now remove the separate check for templates without args as
this is also checked for in finish_id_expression.

PR c++/100482

gcc/cp/ChangeLog:

* parser.cc (cp_parser_decltype_expr): Report errors raised by
finish_id_expression.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/decltype-100482.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/parser.cc
gcc/testsuite/g++.dg/cpp0x/decltype-100482.C [new file with mode: 0644]