From: James A. Morrison Date: Sat, 8 Oct 2005 18:11:02 +0000 (+0000) Subject: re PR c++/22172 (Internal compiler error, seg fault.) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31e832d1f403eb61238b029f81dcafafa763ecc5;p=gcc.git re PR c++/22172 (Internal compiler error, seg fault.) 2005-10-08 James A. Morrison PR c++/22172 * parser.c (cp_parser_postfix_expression) : Treat nontype scopes as nondependent. From-SVN: r105120 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f3f03619bb9..4055464a28a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-08 James A. Morrison + + PR c++/22172 + * parser.c (cp_parser_postfix_expression) : Treat nontype + scopes as nondependent. + 2005-10-06 Volker Reichelt * call.c (resolve_args): Remove redundant test. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 08af6e2f49b..a4eedc17816 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3986,8 +3986,9 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p) return error_mark_node; /* If we look up a template-id in a non-dependent qualifying scope, there's no need to create a dependent type. */ - else if (TREE_CODE (id) == TYPE_DECL - && !dependent_type_p (parser->scope)) + if (TREE_CODE (id) == TYPE_DECL + && (!TYPE_P (scope) + || !dependent_type_p (parser->scope))) type = TREE_TYPE (id); /* Create a TYPENAME_TYPE to represent the type to which the functional cast is being performed. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d189677cebe..811c6cb6dbb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-08 James A. Morrison + + PR c++/22172 + * g++.dg/parse/crash30.C: New test. + 2005-10-07 Richard Guenther PR middle-end/24227 diff --git a/gcc/testsuite/g++.dg/parse/crash30.C b/gcc/testsuite/g++.dg/parse/crash30.C new file mode 100644 index 00000000000..9b68535faa4 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash30.C @@ -0,0 +1,18 @@ +// { dg-do compile } +namespace N { template struct A { operator int() const; }; } +namespace M { template struct A {}; } +namespace P { typedef int I; } + +template void foo() +{ + +typename N::A<0>(); // { dg-bogus "expected" } +} + +template void bar() +{ + +typename M::A<0>; // { dg-error "expected" } +} + +template void baz() { + typename P::I i; // { dg-bogus "expected" } +}