Commit 76d3baad by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/10956 (ICE when specializing a template member function of a template…

re PR c++/10956 (ICE when specializing a template member function of a template class, in tsubst, at cp/pt.c:6459)

	PR c++/10956
	* pt.c (instantiate_decl): Don't use full template arguments if
	we are dealing with specializations.

	* g++.dg/template/spec9.C: New test.

From-SVN: r67268
parent 5fb57097
2003-05-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10956
* pt.c (instantiate_decl): Don't use full template arguments if
we are dealing with specializations.
2003-05-29 Gabriel Dos Reis <gdr@integrable-solutions.net> 2003-05-29 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS. * decl.c (ENABLE_SCOPE_CHECKING): Rename from DEBUG_BINDING_LEVELS.
......
...@@ -10862,10 +10862,11 @@ instantiate_decl (d, defer_ok) ...@@ -10862,10 +10862,11 @@ instantiate_decl (d, defer_ok)
td = template_for_substitution (d); td = template_for_substitution (d);
code_pattern = DECL_TEMPLATE_RESULT (td); code_pattern = DECL_TEMPLATE_RESULT (td);
if (DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d)) if ((DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d))
|| DECL_TEMPLATE_SPECIALIZATION (td))
/* In the case of a friend template whose definition is provided /* In the case of a friend template whose definition is provided
outside the class, we may have too many arguments. Drop the outside the class, we may have too many arguments. Drop the
ones we don't need. */ ones we don't need. The same is true for specializations. */
args = get_innermost_template_args args = get_innermost_template_args
(gen_args, TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (td))); (gen_args, TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (td)));
else else
......
2003-05-31 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10956
* g++.dg/template/spec9.C: New test.
2003-05-29 Roger Sayle <roger@eyesopen.com> 2003-05-29 Roger Sayle <roger@eyesopen.com>
* gcc.dg/duff-4.c: New test case. * gcc.dg/duff-4.c: New test case.
......
// { dg-do compile }
// Origin: Lynn Akers <lakers@peachtree.com>
// Wolfgang Bangerth <bangerth@ticam.utexas.edu>
// PR c++/10956: Incorrect template substitution for member template
// specialization inside template class.
template <int> struct C {
template<typename T> void pre_add(T);
};
template<>
template<typename T>
void C<32>::pre_add(T) {
T pre;
}
int main() {
C<32>().pre_add<int>(1);
}
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