re PR c++/3870 (gcc 3.0 bogus error specializing a template function)
PR c++/3870 * cp-tree.h (struct saved_scope): Add last_parms field. * decl.c (maybe_push_to_top_level): Save last_function_parms. (pop_from_top_level): Restore it. From-SVN: r50970
This commit is contained in:
parent
001ad76c41
commit
0f4237c2da
|
@ -1,5 +1,10 @@
|
|||
2002-03-18 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/3870
|
||||
* cp-tree.h (struct saved_scope): Add last_parms field.
|
||||
* decl.c (maybe_push_to_top_level): Save last_function_parms.
|
||||
(pop_from_top_level): Restore it.
|
||||
|
||||
PR c++/4377
|
||||
* mangle.c (write_expression): Strip NOP_EXPRs sooner. Also strip
|
||||
NON_LVALUE_EXPRs.
|
||||
|
|
|
@ -731,6 +731,7 @@ struct saved_scope
|
|||
tree x_saved_tree;
|
||||
tree incomplete;
|
||||
tree lookups;
|
||||
tree last_parms;
|
||||
|
||||
HOST_WIDE_INT x_processing_template_decl;
|
||||
int x_processing_specialization;
|
||||
|
|
|
@ -2501,6 +2501,7 @@ maybe_push_to_top_level (pseudo)
|
|||
s->bindings = b;
|
||||
s->need_pop_function_context = need_pop;
|
||||
s->function_decl = current_function_decl;
|
||||
s->last_parms = last_function_parms;
|
||||
|
||||
scope_chain = s;
|
||||
current_function_decl = NULL_TREE;
|
||||
|
@ -2542,6 +2543,7 @@ pop_from_top_level ()
|
|||
if (s->need_pop_function_context)
|
||||
pop_function_context_from (NULL_TREE);
|
||||
current_function_decl = s->function_decl;
|
||||
last_function_parms = s->last_parms;
|
||||
|
||||
free (s);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// PR c++/3870
|
||||
// Test that performing a type instantiation in order to match up a
|
||||
// specialization doesn't clobber last_function_parms.
|
||||
|
||||
template <class T>
|
||||
struct A { typedef int I; };
|
||||
|
||||
template <class T>
|
||||
inline typename T::I
|
||||
foo (typename T::I, const T*);
|
||||
|
||||
template <>
|
||||
int foo (int i, const A<long>*)
|
||||
{
|
||||
return i + 1;
|
||||
}
|
Loading…
Reference in New Issue