diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2008-08-12 19:38:02 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2008-08-12 19:38:02 +0000 |
commit | 905319d95e57f935e3f7fab102901334ee0afa02 (patch) | |
tree | f5ba16fa5d24529bdc3f1e9c02895e3b3e7ea501 /gcc | |
parent | 4d2b059d5e51c6cd6cca3cc775268039657d3317 (diff) | |
download | gcc-905319d95e57f935e3f7fab102901334ee0afa02.zip gcc-905319d95e57f935e3f7fab102901334ee0afa02.tar.gz gcc-905319d95e57f935e3f7fab102901334ee0afa02.tar.bz2 |
re PR c++/37087 (Segfault on compiling template defined in wrong namespace.)
/cp
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* parser.c (cp_parser_class_head): Early return error_mark_node in
case of global qualification of class name or qualified name that
does not name a class.
/testsuite
2008-08-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37087
* g++.dg/template/crash80.C: New.
* g++.old-deja/g++.other/decl5.C: Adjust.
From-SVN: r139034
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash80.C | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/decl5.C | 4 |
5 files changed, 34 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5763e3f..00b3613 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/37087 + * parser.c (cp_parser_class_head): Early return error_mark_node in + case of global qualification of class name or qualified name that + does not name a class. + 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/12242 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1bb52e5..fd4e1bb 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -14981,11 +14981,17 @@ cp_parser_class_head (cp_parser* parser, cp_parser_commit_to_tentative_parse (parser); /* Issue the error about the overly-qualified name now. */ if (qualified_p) - cp_parser_error (parser, - "global qualification of class name is invalid"); + { + cp_parser_error (parser, + "global qualification of class name is invalid"); + return error_mark_node; + } else if (invalid_nested_name_p) - cp_parser_error (parser, - "qualified name does not name a class"); + { + cp_parser_error (parser, + "qualified name does not name a class"); + return error_mark_node; + } else if (nested_name_specifier) { tree scope; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f30067d..8399de6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-08-12 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/37087 + * g++.dg/template/crash80.C: New. + * g++.old-deja/g++.other/decl5.C: Adjust. + 2008-08-12 Jakub Jelinek <jakub@redhat.com> PR middle-end/37014 diff --git a/gcc/testsuite/g++.dg/template/crash80.C b/gcc/testsuite/g++.dg/template/crash80.C new file mode 100644 index 0000000..ed462ac --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash80.C @@ -0,0 +1,9 @@ +// PR c++/37087 + +namespace a { + template <typename T> class Foo; +} + +namespace b { + template <> class ::a::Foo<double> {}; // { dg-error "error: global qualification of class name is invalid" } +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/decl5.C b/gcc/testsuite/g++.old-deja/g++.other/decl5.C index f8c447c..62a18e5 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/decl5.C +++ b/gcc/testsuite/g++.old-deja/g++.other/decl5.C @@ -16,7 +16,7 @@ struct A { int m; }; struct Z; - expand me; + expand me; // { dg-error "" } not name a type void foo(struct A::e); void foo(struct A::z); // { dg-warning "" } extra qualification }; @@ -71,7 +71,7 @@ namespace NMS }; } -NMS::D thing; +NMS::D thing; // { dg-error "" } not name a type void NMS::fn() { i = 3; |