commit 9a2db2e62c441147007f520a3983f6bc12a7385f
Author: Jason Merrill <jason@redhat.com>
Date: Wed Apr 11 11:05:28 2012 -0400
* decl.c (grokdeclarator): Strip the injected-class-name typedef
if we are building a declaration or compound type.
@@ -8943,6 +8943,17 @@ grokdeclarator (const cp_declarator *declarator,
error ("qualifiers are not allowed on declaration of %<operator %T%>",
ctor_return_type);
+ /* If we're using the injected-class-name to form a compound type or a
+ declaration, replace it with the underlying class so we don't get
+ redundant typedefs in the debug output. But if we are returning the
+ type unchanged, leave it alone so that it's available to
+ maybe_get_template_decl_from_type_decl. */
+ if (CLASS_TYPE_P (type)
+ && DECL_SELF_REFERENCE_P (TYPE_NAME (type))
+ && type == TREE_TYPE (TYPE_NAME (type))
+ && (declarator || type_quals))
+ type = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
+
type_quals |= cp_type_quals (type);
type = cp_build_qualified_type_real
(type, type_quals, ((typedef_decl && !DECL_ARTIFICIAL (typedef_decl)
@@ -5,7 +5,7 @@
struct A
{
- virtual ~A();
+ virtual ~A(){}
};
struct B : public A
@@ -6,7 +6,7 @@
template<class T>
struct A
{
- virtual ~A();
+ virtual ~A(){}
};
struct B : public A<int>