Commit 59dd34c4 by Jason Merrill Committed by Jason Merrill

re PR c++/46129 (ICE: in tsubst_copy, at cp/pt.c:11375)

	PR c++/46129
	* pt.c (instantiate_class_template): Don't instantiate default
	arguments.

From-SVN: r165850
parent f91352dc
2010-10-22 Jason Merrill <jason@redhat.com> 2010-10-22 Jason Merrill <jason@redhat.com>
PR c++/46129
* pt.c (instantiate_class_template): Don't instantiate default
arguments.
PR c++/46103 PR c++/46103
* init.c (build_vec_init): Handle memberwise move. * init.c (build_vec_init): Handle memberwise move.
......
...@@ -8238,17 +8238,12 @@ instantiate_class_template (tree type) ...@@ -8238,17 +8238,12 @@ instantiate_class_template (tree type)
finish_struct_1 (type); finish_struct_1 (type);
TYPE_BEING_DEFINED (type) = 0; TYPE_BEING_DEFINED (type) = 0;
/* Now that the class is complete, instantiate default arguments for /* We don't instantiate default arguments for member functions. 14.7.1:
any member functions. We don't do this earlier because the
default arguments may reference members of the class. */ The implicit instantiation of a class template specialization causes
if (!PRIMARY_TEMPLATE_P (templ)) the implicit instantiation of the declarations, but not of the
for (t = TYPE_METHODS (type); t; t = DECL_CHAIN (t)) definitions or default arguments, of the class member functions,
if (TREE_CODE (t) == FUNCTION_DECL member classes, static data members and member templates.... */
/* Implicitly generated member functions will not have template
information; they are not instantiations, but instead are
created "fresh" for each instantiation. */
&& DECL_TEMPLATE_INFO (t))
tsubst_default_arguments (t);
/* Some typedefs referenced from within the template code need to be access /* Some typedefs referenced from within the template code need to be access
checked at template instantiation time, i.e now. These types were checked at template instantiation time, i.e now. These types were
......
2010-10-22 Jason Merrill <jason@redhat.com> 2010-10-22 Jason Merrill <jason@redhat.com>
PR c++/46129
* g++.dg/template/defarg14.C: New.
2010-10-22 Jason Merrill <jason@redhat.com>
PR c++/46103 PR c++/46103
* g++.dg/cpp0x/implicit10.C: New. * g++.dg/cpp0x/implicit10.C: New.
......
// PR c++/46129
// The default argument for A<int>::B::operator() should not be instantiated
template <class T>
struct A {
struct B {
void operator () (const T& d_ = f(T()) ) { }
};
};
int main() {
A<int>::B b;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment