From: Nathan Sidwell Date: Thu, 24 May 2001 12:00:52 +0000 (+0000) Subject: re PR c++/2184 (using declarations for classes in function templates) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f56d9253f78d537e2af74895512188743519ff7;p=gcc.git re PR c++/2184 (using declarations for classes in function templates) cp: PR c++/2184 * decl2.c (do_local_using_decl): Push the decls, even in a template. testsuite: * g++.old-deja/g++.pt/using1.C: Adjust. * g++.old-deja/g++.pt/using2.C: New test. From-SVN: r42526 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f3391eca8a..577cf532fa9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-05-24 Nathan Sidwell + + PR c++/2184 + * decl2.c (do_local_using_decl): Push the decls, even in a + template. + 2001-05-22 Mark Mitchell * optimize.c (initialize_inlined_parameters): Don't set diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ba98dc5e7e7..0245bc0755c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -5136,8 +5136,6 @@ do_local_using_decl (decl) if (building_stmt_tree () && at_function_scope_p ()) add_decl_stmt (decl); - if (processing_template_decl) - return; oldval = lookup_name_current_level (name); oldtype = lookup_type_current_level (name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 826918ea64e..8f74ba35143 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-05-24 Nathan Sidwell + + * g++.old-deja/g++.pt/using1.C: Adjust. + * g++.old-deja/g++.pt/using2.C: New test. + 2001-05-23 Neil Booth * gcc.dg/cpp/charconst.c: New tests. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/using1.C b/gcc/testsuite/g++.old-deja/g++.pt/using1.C index eca6c501214..632fca00a45 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/using1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/using1.C @@ -15,6 +15,8 @@ template void f() template void f (); +int foo (int) { return 0;} + namespace B { int foo (int) { return 1;} @@ -28,8 +30,6 @@ namespace B template int baz (); }; -int foo (int) { return 0;} - int main () { return B::baz (); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/using2.C b/gcc/testsuite/g++.old-deja/g++.pt/using2.C new file mode 100644 index 00000000000..5d47b7527a6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/using2.C @@ -0,0 +1,26 @@ +// Build don't link: +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 22 May 2001 + +// Bug 2184. Using decls in templates weren't doing the right thing. + +namespace N { + template + class vector {}; +} + +void g(const int&) { + using N::vector; + typedef vector V; +} + +template +void f(const J&) { + using N::vector; + typedef vector V; +} + +int main() { + f(0); +}