[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

Richard Smith richard at metafoo.co.uk
Tue Nov 27 20:22:04 PST 2012


On Tue, Nov 27, 2012 at 8:10 PM, John McCall <rjmccall at apple.com> wrote:

> 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?


We don't have wording for the core issue yet (maybe you could poke Doug?).
But yes, we diagnose any case where default arguments are added outside the
class definition and they cause a member to become a special member, per
the notes from the Bloomington CWG discussion.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121127/7c693c44/attachment.html>


More information about the cfe-commits mailing list