diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-05-24 12:00:52 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-05-24 12:00:52 +0000 |
commit | 6f56d9253f78d537e2af74895512188743519ff7 (patch) | |
tree | 42a9ab80111c2cda4ddfaf72596e9b69a1a0fedc | |
parent | 8948cb39720f8843baf5db391eceef189ddf7ec3 (diff) | |
download | gcc-6f56d9253f78d537e2af74895512188743519ff7.zip gcc-6f56d9253f78d537e2af74895512188743519ff7.tar.gz gcc-6f56d9253f78d537e2af74895512188743519ff7.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/using1.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/using2.C | 26 |
5 files changed, 39 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f3391e..577cf53 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-05-24 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/2184 + * decl2.c (do_local_using_decl): Push the decls, even in a + template. + 2001-05-22 Mark Mitchell <mark@codesourcery.com> * optimize.c (initialize_inlined_parameters): Don't set diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index ba98dc5..0245bc0 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 826918e..8f74ba3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-05-24 Nathan Sidwell <nathan@codesourcery.com> + + * g++.old-deja/g++.pt/using1.C: Adjust. + * g++.old-deja/g++.pt/using2.C: New test. + 2001-05-23 Neil Booth <neil@daikokuya.demon.co.uk> * 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 eca6c50..632fca0 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 <class T> void f() template void f<float> (); +int foo (int) { return 0;} + namespace B { int foo (int) { return 1;} @@ -28,8 +30,6 @@ namespace B template int baz<float> (); }; -int foo (int) { return 0;} - int main () { return B::baz<float> (); 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 0000000..5d47b75 --- /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 <nathan@codesourcery.com> + +// Bug 2184. Using decls in templates weren't doing the right thing. + +namespace N { + template <class T> + class vector {}; +} + +void g(const int&) { + using N::vector; + typedef vector<int> V; +} + +template <class J> +void f(const J&) { + using N::vector; + typedef vector<int> V; +} + +int main() { + f(0); +} |