From 89a249f2ecbdfe856dab2cd82f913a93c88ecbfe Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 6 Dec 2018 19:43:17 +0000 Subject: PR c++/88373 - wrong parse error with ~. * parser.c (cp_parser_template_name): Check tag_type for none_type. * g++.dg/cpp2a/fn-template19.C: New test. From-SVN: r266865 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp2a/fn-template19.C | 11 +++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp2a/fn-template19.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 89f2d88..1a3e73e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-12-06 Marek Polacek + + PR c++/88373 - wrong parse error with ~. + * parser.c (cp_parser_template_name): Check tag_type for + none_type. + 2018-12-06 Segher Boessenkool * cp-tree.h (finish_asm_stmt): Update declaration. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index ceae72a..adfe09e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -16579,7 +16579,8 @@ cp_parser_template_name (cp_parser* parser, if (!found && (cxx_dialect > cxx17) && !scoped_p - && cp_lexer_next_token_is (parser->lexer, CPP_LESS)) + && cp_lexer_next_token_is (parser->lexer, CPP_LESS) + && tag_type == none_type) { /* [temp.names] says "A name is also considered to refer to a template if it is an unqualified-id followed by a < and name lookup finds diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index acac4fd..047b4b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-06 Marek Polacek + + PR c++/88373 - wrong parse error with ~. + * g++.dg/cpp2a/fn-template19.C: New test. + 2018-12-06 Richard Sandiford * gcc.dg/vect/vect-over-widen-23.c: Remove unwanted line. diff --git a/gcc/testsuite/g++.dg/cpp2a/fn-template19.C b/gcc/testsuite/g++.dg/cpp2a/fn-template19.C new file mode 100644 index 0000000..1d6b43b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/fn-template19.C @@ -0,0 +1,11 @@ +// PR c++/88373 +// { dg-do compile } +// { dg-options "-std=c++2a" } + +template +constexpr T value = T {}; + +template +struct S {}; + +using U = S >; -- cgit v1.1