Commit 7e8ec1ec by Jason Merrill Committed by Jason Merrill

re PR c++/39164 ([C++0x] defaulted dtor redefinition not caught)

	PR c++/39164
	* decl.c (grokfndecl): Diagnose redefinition of defaulted fn.

From-SVN: r179634
parent 885c4871
2011-10-06 Jason Merrill <jason@redhat.com>
PR c++/39164
* decl.c (grokfndecl): Diagnose redefinition of defaulted fn.
2011-10-02 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_pack_expansion): Re-use ARGUMENT_PACK_SELECTs.
......
......@@ -7418,6 +7418,12 @@ grokfndecl (tree ctype,
error ("definition of implicitly-declared %qD", old_decl);
return NULL_TREE;
}
else if (DECL_DEFAULTED_FN (old_decl))
{
error ("definition of explicitly-defaulted %q+D", decl);
error ("%q+#D explicitly defaulted here", old_decl);
return NULL_TREE;
}
/* Since we've smashed OLD_DECL to its
DECL_TEMPLATE_RESULT, we must do the same to DECL. */
......
2011-10-06 Jason Merrill <jason@redhat.com>
PR c++/39164
* g++.dg/cpp0x/default31.C: New.
2011-10-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/50596
......
// PR c++/39164
// { dg-options -std=c++0x }
struct A
{
A() { } // { dg-error "defined" }
~A() = default; // { dg-error "defaulted" }
};
A::A() = default; // { dg-error "redefinition" }
A::~A() noexcept (true) { } // { dg-error "defaulted" }
int main()
{
A a;
}
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