2004-10-11 Mark Mitchell <mark@codesourcery.com>
+ PR c++/17936
+ * cp-tree.h (CLASSTYPE_TEMPLATE_SPECIALIZATION): Add a comment.
+ * pt.c (optimize_specialization_lookup_p): Do not optimize lookups
+ for members of partial or explicit specializations.
+
PR c++/17929
* decl2.c (finish_anon_union): Robustify.
#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
+
+/* Returns true for an explicit or partial specialization of a class
+ template. */
#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
(CLASSTYPE_USE_TEMPLATE (NODE) == 2)
#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
/* DECL_CLASS_SCOPE_P holds of T::f even if T is a template
parameter. */
&& CLASS_TYPE_P (DECL_CONTEXT (tmpl))
+ /* The optimized lookup depends on the fact that the
+ template arguments for the member function template apply
+ purely to the containing class, which is not true if the
+ containing class is an explicit or partial
+ specialization. */
+ && !CLASSTYPE_TEMPLATE_SPECIALIZATION (DECL_CONTEXT (tmpl))
&& !DECL_MEMBER_TEMPLATE_P (tmpl)
&& !DECL_CONV_FN_P (tmpl)
/* It is possible to have a template that is not a member
+2004-10-11 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/17936
+ * g++.dg/template/spec18.C: New test.
+
2004-10-11 Steve Ellcey <sje@cup.hp.com>
* testsuite/gcc.dg/ia64-asm-1.c: Add prototype for abort
--- /dev/null
+// PR c++/17936
+
+template<int, int N> struct A
+{
+ void foo();
+};
+
+template<int N> struct A<1, N>
+{
+ void foo();
+};
+
+template<> void A<1, 2>::foo();