cp-tree.h (IS_AGGR_TYPE): Include instantiated template template parameters.
authorMark Mitchell <mark@codesourcery.com>
Mon, 5 Jul 1999 14:04:46 +0000 (14:04 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 5 Jul 1999 14:04:46 +0000 (14:04 +0000)
* cp-tree.h (IS_AGGR_TYPE): Include instantiated template template
parameters.
(IMPLICIT_TYPENAME_TYPE_DECL_P): New macro.
* decl.c (push_class_binding): Use it.
(lookup_name_real): Likewise.

From-SVN: r27948

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.oliva/template2.C
gcc/testsuite/g++.old-deja/g++.oliva/typename1.C
gcc/testsuite/g++.old-deja/g++.oliva/typename2.C

index 40d5aac7d8840b0bdd4ddcdda60e1c693bb5dd1f..90011a3b9e0954907bc11de6696e4b6bc7a80d9f 100644 (file)
@@ -1,3 +1,11 @@
+1999-07-05  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.h (IS_AGGR_TYPE): Include instantiated template template
+       parameters.
+       (IMPLICIT_TYPENAME_TYPE_DECL_P): New macro.
+       * decl.c (push_class_binding): Use it.
+       (lookup_name_real): Likewise.
+
 1999-07-02  Gavin Romig-Koch  <gavin@cygnus.com>
 
        * cp-tree.h (widest_integer_literal_type_node,
index 28c7e3fe6f9e09531a387fd066ee7d5e1455d107..b84a6adda5fea16d28753597b880caad13ac1f87 100644 (file)
@@ -587,13 +587,16 @@ enum languages { lang_c, lang_cplusplus, lang_java };
 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
 
 /* Nonzero if T is a class (or struct or union) type.  Also nonzero
-   for template type parameters and typename types.  Despite its name,
+   for template type parameters, typename types, and instantiated
+   template template parameters.  Despite its name,
    this macro has nothing to do with the definition of aggregate given
    in the standard.  Think of this macro as MAYBE_CLASS_TYPE_P.  */
 #define IS_AGGR_TYPE(t)                                \
-  (TREE_CODE (t) == TEMPLATE_TYPE_PARM                 \
-   || TREE_CODE (t) == TYPENAME_TYPE           \
+  (TREE_CODE (t) == TEMPLATE_TYPE_PARM         \
+   || TREE_CODE (t) == TYPENAME_TYPE           \
    || TREE_CODE (t) == TYPEOF_TYPE             \
+   || (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM \
+       && TYPE_TEMPLATE_INFO (t))              \
    || TYPE_LANG_FLAG_5 (t))
 
 /* Set IS_AGGR_TYPE for T to VAL.  T must be a class, struct, or 
@@ -1517,6 +1520,13 @@ struct lang_decl
 #define IMPLICIT_TYPENAME_P(NODE) \
   (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
 
+/* Nonzero if NODE is a TYPE_DECL that should not be visible because
+   it is from a dependent base class.  */
+#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE)    \
+  (TREE_CODE (NODE) == TYPE_DECL               \
+   && DECL_ARTIFICIAL (NODE)                   \
+   && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
+
 /* Nonzero in INTEGER_CST means that this int is negative by dint of
    using a twos-complement negated operand.  */
 #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
index 1b6b268b5b74894b0c3f99e9e28841edd8efb3eb..cad878ae9e2be025a08687447b21f1b979b5500b 100644 (file)
@@ -1256,8 +1256,7 @@ push_class_binding (id, decl)
         context for an implicit typename declaration is always
         the derived class in which the lookup was done, so the checks
         based on the context of DECL below will not trigger.  */
-      if (TREE_CODE (decl) == TYPE_DECL 
-         && IMPLICIT_TYPENAME_P (TREE_TYPE (decl)))
+      if (IMPLICIT_TYPENAME_TYPE_DECL_P (decl))
        INHERITED_VALUE_BINDING_P (binding) = 1;
       else
        {
@@ -5877,15 +5876,13 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
        binding = NULL_TREE;
 
       if (binding
-         && (!val || !(TREE_CODE (binding) == TYPE_DECL
-                       && IMPLICIT_TYPENAME_P (TREE_TYPE (binding)))))
+         && (!val || !IMPLICIT_TYPENAME_TYPE_DECL_P (binding)))
        {
          if (val_is_implicit_typename && !yylex)
            warn_about_implicit_typename_lookup (val, binding);
          val = binding;
          val_is_implicit_typename 
-           = (TREE_CODE (val) == TYPE_DECL
-              && IMPLICIT_TYPENAME_P (TREE_TYPE (val)));
+           = IMPLICIT_TYPENAME_TYPE_DECL_P (val);
          if (!val_is_implicit_typename)
            break;
        }
index 2f938e8cadda40756aea58354afad69f176d800f..15874f0b025c677f50fcac87ae00e6337f40063e 100644 (file)
@@ -11,4 +11,4 @@ template <template <typename> class C, typename T> class foo {
 };
 
 template <template <typename> class C, typename T> foo<C,T>::foo(bar)
-{} // gets bogus error - C<T> not a class - XFAIL *-*-*
+{} // gets bogus error - C<T> not a class
index af3d658f3fab5580c3945158495ca77123ddaed9..d46ec603286dde91118c034e5f737848618b7e63 100644 (file)
@@ -5,8 +5,6 @@
 // by Alexandre Oliva <oliva@dcc.unicamp.br>
 // based on bug report by Nick Rasmussen <nick@jive.org>
 
-// crash test - XFAIL *-*-*
-
 template <class T> struct foo;
 
 template <class T> struct bar {
@@ -14,6 +12,6 @@ template <class T> struct bar {
 };
 
 template <class T> struct baz {
-  typedef bar<T>::foo foo; // ERROR - missing typename
+  typedef bar<T>::foo foo; // ERROR - missing typename - XFAIL *-*-*
   void m(foo);
 };
index f50ef48196f5024367b0bec565a76d0d889d7fc4..2428206a04a277145f37ca41103326b187644e1e 100644 (file)
@@ -24,5 +24,5 @@ template <class T> struct bar {
 
 template <class T> struct baz {
   typedef bar<T>::foo foo; // ERROR - implicit typename - XFAIL *-*-*
-  void m(foo); // gets bogus error - dependent base class - XFAIL *-*-*
+  void m(foo); 
 };