Commit 83233dca by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (IS_AGGR_TYPE): Include instantiated template template parameters.

	* 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
parent c704c83c
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> 1999-07-02 Gavin Romig-Koch <gavin@cygnus.com>
* cp-tree.h (widest_integer_literal_type_node, * cp-tree.h (widest_integer_literal_type_node,
......
...@@ -587,13 +587,16 @@ enum languages { lang_c, lang_cplusplus, lang_java }; ...@@ -587,13 +587,16 @@ enum languages { lang_c, lang_cplusplus, lang_java };
#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE))) #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 /* 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 this macro has nothing to do with the definition of aggregate given
in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */ in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
#define IS_AGGR_TYPE(t) \ #define IS_AGGR_TYPE(t) \
(TREE_CODE (t) == TEMPLATE_TYPE_PARM \ (TREE_CODE (t) == TEMPLATE_TYPE_PARM \
|| TREE_CODE (t) == TYPENAME_TYPE \ || TREE_CODE (t) == TYPENAME_TYPE \
|| TREE_CODE (t) == TYPEOF_TYPE \ || TREE_CODE (t) == TYPEOF_TYPE \
|| (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM \
&& TYPE_TEMPLATE_INFO (t)) \
|| TYPE_LANG_FLAG_5 (t)) || TYPE_LANG_FLAG_5 (t))
/* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
...@@ -1517,6 +1520,13 @@ struct lang_decl ...@@ -1517,6 +1520,13 @@ struct lang_decl
#define IMPLICIT_TYPENAME_P(NODE) \ #define IMPLICIT_TYPENAME_P(NODE) \
(TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (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 /* Nonzero in INTEGER_CST means that this int is negative by dint of
using a twos-complement negated operand. */ using a twos-complement negated operand. */
#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE)) #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
......
...@@ -1256,8 +1256,7 @@ push_class_binding (id, decl) ...@@ -1256,8 +1256,7 @@ push_class_binding (id, decl)
context for an implicit typename declaration is always context for an implicit typename declaration is always
the derived class in which the lookup was done, so the checks the derived class in which the lookup was done, so the checks
based on the context of DECL below will not trigger. */ based on the context of DECL below will not trigger. */
if (TREE_CODE (decl) == TYPE_DECL if (IMPLICIT_TYPENAME_TYPE_DECL_P (decl))
&& IMPLICIT_TYPENAME_P (TREE_TYPE (decl)))
INHERITED_VALUE_BINDING_P (binding) = 1; INHERITED_VALUE_BINDING_P (binding) = 1;
else else
{ {
...@@ -5877,15 +5876,13 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only) ...@@ -5877,15 +5876,13 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
binding = NULL_TREE; binding = NULL_TREE;
if (binding if (binding
&& (!val || !(TREE_CODE (binding) == TYPE_DECL && (!val || !IMPLICIT_TYPENAME_TYPE_DECL_P (binding)))
&& IMPLICIT_TYPENAME_P (TREE_TYPE (binding)))))
{ {
if (val_is_implicit_typename && !yylex) if (val_is_implicit_typename && !yylex)
warn_about_implicit_typename_lookup (val, binding); warn_about_implicit_typename_lookup (val, binding);
val = binding; val = binding;
val_is_implicit_typename val_is_implicit_typename
= (TREE_CODE (val) == TYPE_DECL = IMPLICIT_TYPENAME_TYPE_DECL_P (val);
&& IMPLICIT_TYPENAME_P (TREE_TYPE (val)));
if (!val_is_implicit_typename) if (!val_is_implicit_typename)
break; break;
} }
......
...@@ -11,4 +11,4 @@ template <template <typename> class C, typename T> class foo { ...@@ -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) 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
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
// by Alexandre Oliva <oliva@dcc.unicamp.br> // by Alexandre Oliva <oliva@dcc.unicamp.br>
// based on bug report by Nick Rasmussen <nick@jive.org> // based on bug report by Nick Rasmussen <nick@jive.org>
// crash test - XFAIL *-*-*
template <class T> struct foo; template <class T> struct foo;
template <class T> struct bar { template <class T> struct bar {
...@@ -14,6 +12,6 @@ template <class T> struct bar { ...@@ -14,6 +12,6 @@ template <class T> struct bar {
}; };
template <class T> struct baz { 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); void m(foo);
}; };
...@@ -24,5 +24,5 @@ template <class T> struct bar { ...@@ -24,5 +24,5 @@ template <class T> struct bar {
template <class T> struct baz { template <class T> struct baz {
typedef bar<T>::foo foo; // ERROR - implicit typename - XFAIL *-*-* typedef bar<T>::foo foo; // ERROR - implicit typename - XFAIL *-*-*
void m(foo); // gets bogus error - dependent base class - XFAIL *-*-* void m(foo);
}; };
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