[cfe-commits] r168769 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclCXX.cpp test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp test/SemaCXX/copy-constructor-error.cpp test/SemaCXX/default-arg-special-member.cpp

John McCall rjmccall at apple.com
Tue Nov 27 20:10:56 PST 2012


On Nov 27, 2012, at 7:45 PM, Richard Smith <richard-llvm at metafoo.co.uk> wrote:
> Author: rsmith
> Date: Tue Nov 27 21:45:24 2012
> New Revision: 168769
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=168769&view=rev
> Log:
> C++ core issue 1344, PR10618: promote "addition of default argument makes this
> a special member" diagnostic from warning to error, and fix the cases where it
> produced diagnostics with incorrect wording.
> 
> We don't support this as an extension, and we ban it even in C++98 mode. This
> breaks too much (for instance, the ABI-specified calling convention for a type
> can change if it acquires a copy constructor through the addition of a default
> argument).

Is it an error to add a default argument when there's already a special member of that exact type (ignoring the now-defaulted parameters)?  e.g.

  struct A {
    int x;
    A() = default;
    A(int x);
  };

  A::A(int x = 7) : x(x) {} // error?

John.



More information about the cfe-commits mailing list