From: Nathan Sidwell Date: Mon, 3 Dec 2001 12:39:49 +0000 (+0000) Subject: re PR c++/3381 (explicit template instantations fail with absolutely qualified names) X-Git-Tag: prereleases/libstdc++-3.0.95~569 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f1880e134cfdc12afecb48cb345bad896bbdf318;p=thirdparty%2Fgcc.git re PR c++/3381 (explicit template instantations fail with absolutely qualified names) cp: PR g++/3381 * parse.y (named_complex_class_head_sans_basetype): Add new reduction. * Make-lang.in (parse.c): Adjust expected conflict count. testsuite: * g++.dg/other/scope1.C: New test. * g++.dg/template/explicit-instantiation.C: Remove XFAIL From-SVN: r47546 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eaa3a9ba4d61..6b970756d4a4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2001-12-03 Nathan Sidwell + + PR g++/3381 + * parse.y (named_complex_class_head_sans_basetype): Add new + reduction. + * Make-lang.in (parse.c): Adjust expected conflict count. + 2001-12-03 Jason Merrill * class.c (finish_vtbls): Fill in BINFO_VPTR_FIELD in the diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 2a4d6af36944..eb42decff4fe 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -119,7 +119,7 @@ $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf $(srcdir)/cp/cfns.gperf > $(srcdir)/cp/cfns.h $(srcdir)/cp/parse.h $(srcdir)/cp/parse.c: $(srcdir)/cp/parse.y - @echo "Expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts." + @echo "Expect 36 shift/reduce conflicts and 58 reduce/reduce conflicts." cd $(srcdir)/cp; $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \ grep '^#define[ ]*YYEMPTY' p$$$$.c >> p$$$$.h ; \ mv -f p$$$$.c parse.c ; mv -f p$$$$.h parse.h diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 449ea9830d0c..a27f288eedcb 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -2404,6 +2404,13 @@ named_complex_class_head_sans_basetype: push_scope (CP_DECL_CONTEXT ($$.t)); $$.new_type_flag = 1; } + | aggr global_scope nested_name_specifier apparent_template_type + { + current_aggr = $1; + $$.t = $4; + push_scope (CP_DECL_CONTEXT ($$.t)); + $$.new_type_flag = 1; + } ; named_class_head: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7f7138990e13..a9715d8734e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-12-03 Nathan Sidwell + + * g++.dg/other/scope1.C: New test. + * g++.dg/template/explicit-instantiation.C: Remove XFAIL + 2001-12-03 Joseph S. Myers * gcc.dg/vla-init-1.c: New test. diff --git a/gcc/testsuite/g++.dg/other/scope1.C b/gcc/testsuite/g++.dg/other/scope1.C new file mode 100644 index 000000000000..73b141bdf0b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/scope1.C @@ -0,0 +1,14 @@ +// { dg-do compile } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 30 Nov 2001 + +// PR 3381 + +namespace N { + template + class A { }; +} + +template class N::A; // this works (by itself) +template class ::N::A; // but this doesn't diff --git a/gcc/testsuite/g++.dg/template/explicit-instantiation.C b/gcc/testsuite/g++.dg/template/explicit-instantiation.C index 9afc35fccc57..67e44c49f024 100644 --- a/gcc/testsuite/g++.dg/template/explicit-instantiation.C +++ b/gcc/testsuite/g++.dg/template/explicit-instantiation.C @@ -2,13 +2,15 @@ // Origin: Jens.Maurer@gmx.net // { dg-do compile } +// Fixed: PR 3381 + namespace N { template class A { }; } -template class ::N::A; // { dg-bogus ".*" "" { xfail *-*-* } } +template class ::N::A;