gcc/
* dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT.
gcc/cp/
* class.c (build_self_reference): Call set_underlying_type.
* decl.c (check_elaborated_type_specifier): Don't complain about
injected-class-name.
(type_is_deprecated): Use TYPE_MAIN_VARIANT.
* pt.c (convert_template_argument): Handle injected-class-name used
as template template argument.
* typeck2.c (abstract_virtuals_error): Use TYPE_MAIN_VARIANT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154354
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-11-19 Jason Merrill <jason@redhat.com>
+
+ * dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT.
+
2009-11-19 Basile Starynkevitch <basile@starynkevitch.net>
Rafael Avila de Espindola <espindola@google.com>
2009-11-19 Jason Merrill <jason@redhat.com>
+ DR 176 permissiveness
+ * class.c (build_self_reference): Call set_underlying_type.
+ * decl.c (check_elaborated_type_specifier): Don't complain about
+ injected-class-name.
+ (type_is_deprecated): Use TYPE_MAIN_VARIANT.
+ * pt.c (convert_template_argument): Handle injected-class-name used
+ as template template argument.
+ * typeck2.c (abstract_virtuals_error): Use TYPE_MAIN_VARIANT.
+
PR c++/561
* decl.c (static_fn_type): Split out...
(revert_static_member_fn): ...from here.
DECL_CONTEXT (value) = current_class_type;
DECL_ARTIFICIAL (value) = 1;
SET_DECL_SELF_REFERENCE_P (value);
+ set_underlying_type (value);
if (processing_template_decl)
value = push_template_decl (value);
&& TREE_DEPRECATED (TYPE_NAME (type)))
return type;
+ /* Do warn about using typedefs to a deprecated class. */
+ if (TAGGED_TYPE_P (type) && type != TYPE_MAIN_VARIANT (type))
+ return type_is_deprecated (TYPE_MAIN_VARIANT (type));
+
code = TREE_CODE (type);
if (code == POINTER_TYPE || code == REFERENCE_TYPE
elaborated type specifier is the implicit typedef created when
the type is declared. */
else if (!DECL_IMPLICIT_TYPEDEF_P (decl)
+ && !DECL_SELF_REFERENCE_P (decl)
&& tag_code != typename_type)
{
error ("using typedef-name %qD after %qs", decl, tag_name (tag_code));
if (TREE_CODE (arg) == TYPE_PACK_EXPANSION)
arg = PACK_EXPANSION_PATTERN (arg);
+ /* Deal with an injected-class-name used as a template template arg. */
+ if (requires_tmpl_type && CLASS_TYPE_P (arg))
+ {
+ tree t = maybe_get_template_decl_from_type_decl (TYPE_NAME (arg));
+ if (TREE_CODE (t) == TEMPLATE_DECL)
+ {
+ if (complain & tf_warning_or_error)
+ pedwarn (input_location, OPT_pedantic, "injected-class-name %qD"
+ " used as template template argument", TYPE_NAME (arg));
+ else if (flag_pedantic_errors)
+ t = arg;
+
+ arg = t;
+ }
+ }
+
is_tmpl_type =
((TREE_CODE (arg) == TEMPLATE_DECL
&& TREE_CODE (DECL_TEMPLATE_RESULT (arg)) == TYPE_DECL)
be abstract. */
if (!CLASS_TYPE_P (type))
return 0;
+ type = TYPE_MAIN_VARIANT (type);
/* If the type is incomplete, we register it within a hash table,
so that we can check again once it is completed. This makes sense
{
/* Find die that represents this context. */
if (TYPE_P (context))
- return force_type_die (context);
+ return force_type_die (TYPE_MAIN_VARIANT (context));
else
return force_decl_die (context);
}
+2009-11-19 Jason Merrill <jason@redhat.com>
+
+ DR 176 permissiveness
+ * g++.dg/ext/injected-ttp.C: New.
+ * g++.old-deja/g++.pt/niklas01a.C: Adjust.
+ * g++.old-deja/g++.pt/ttp41.C: Adjust.
+
2009-11-19 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
* gcc.c-torture/compile/pr40204.c: Test only for int32 target.
--- /dev/null
+// Test for doing the right thing with injected-class-name used as template
+// type argument. This is an extension from DR 176.
+
+// { dg-options "-pedantic" }
+
+template <class T>
+struct A { };
+
+template <template <class> class TTP>
+struct B { };
+
+struct C: A<int>
+{
+ B<A> b; // { dg-warning "injected-class-name" }
+};
// { dg-options "-fshow-column" }
struct A { // { dg-error "" } forward declaration
- friend struct B : A { // { dg-error "invalid use of incomplete type 'struct A'" }
+ friend struct B : A { // { dg-error "invalid use of incomplete type 'struct A" }
int x;
}; // { dg-error "class definition may not be declared a friend" "" { target *-*-* } { 5 } }
int y;
// { dg-do compile }
+// { dg-options "" }
template<template<class> class D,class E> class C
{
public:
template<class T> int D<T>::f()
{
- C<D,D> c; // { dg-error "" }
- return c.g(); // { dg-error "" }
+ C<D,D> c;
+ return c.g();
}
int main()