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
This commit is contained in:
Nathan Sidwell 2001-05-24 12:00:52 +00:00 committed by Nathan Sidwell
parent 8948cb3972
commit 6f56d9253f
5 changed files with 39 additions and 4 deletions

View File

@ -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

View File

@ -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);

View File

@ -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.

View File

@ -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> ();

View File

@ -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);
}