Fix regression introduced with patch for c++/775
* parse.y (class_head_defn): Check for template specializations
with a different class-key.
testsuite:
* g++.dg/template/access1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49016
138bc75d-0d04-0410-961f-
82ee72b054a4
+2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ Fix regression introduced with patch for c++/775
+ * parse.y (class_head_defn): Check for template specializations
+ with a different class-key.
+
2002-01-17 Jason Merrill <jason@redhat.com>
* decl.c (begin_constructor_body, begin_destructor_body): New fns.
yyungetc ('{', 1);
$$.t = $1;
$$.new_type_flag = 0;
+ if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
+ /* We might be specializing a template with a different
+ class-key. */
+ CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
+ = (current_aggr == class_type_node);
}
| class_head_apparent_template ':'
{
yyungetc (':', 1);
$$.t = $1;
$$.new_type_flag = 0;
+ if (TREE_CODE (TREE_TYPE ($1)) == RECORD_TYPE)
+ /* We might be specializing a template with a different
+ class-key. */
+ CLASSTYPE_DECLARED_CLASS (TREE_TYPE ($1))
+ = (current_aggr == class_type_node);
}
| aggr identifier_defn '{'
{
+2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/template/access1.C: New test.
+
2002-01-18 Aldy Hernandez <aldyh@redhat.com>
* gcc.dg/20020118-1.c: New.
--- /dev/null
+// { dg-do compile }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 19 Jan 2002 <nathan@codesourcery.com>
+
+// It is legal to specialize a template with a different class-key.
+
+template<typename T> class X;
+
+template<typename T> struct X<T *>
+{
+ int i;
+};
+template<> struct X<int>
+{
+ int i;
+};
+
+void foo ()
+{
+ X<int *> xip;
+ X<int> xi;
+
+ xip.i;
+ xi.i;
+}
+