r343285 - [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
Galina Kistanova via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 28 16:51:30 PDT 2018
Hello Richard,
This commit broke couple of our builders:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/12924
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/10475
. . .
FAILED:
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/install/stage1/bin/clang++
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Ilib/Transforms/Instrumentation
-I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation
-Iinclude
-I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/include
-fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -Wall -Wextra
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-ffunction-sections -fdata-sections -O3 -UNDEBUG -fno-exceptions
-fno-rtti -MD -MT
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
-MF
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o.d
-o
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
-c
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:231:24:
error: explicitly defaulted move assignment operator is implicitly deleted
[-Werror,-Wdefaulted-function-deleted]
TransformedFunction& operator=(TransformedFunction&&) = default;
^
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:234:23:
note: move assignment operator of 'TransformedFunction' is implicitly
deleted because field 'OriginalType' is of const-qualified type
'llvm::FunctionType *const'
FunctionType* const OriginalType;
^
1 error generated.
Please have a look?
Thanks
Galina
On Thu, Sep 27, 2018 at 6:18 PM Richard Smith via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: rsmith
> Date: Thu Sep 27 18:16:43 2018
> New Revision: 343285
>
> URL: http://llvm.org/viewvc/llvm-project?rev=343285&view=rev
> Log:
> [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
> render the function deleted instead of rendering the program ill-formed.
>
> This change also adds an enabled-by-default warning for the case where
> an explicitly-defaulted special member function of a non-template class
> is implicitly deleted by the type checking rules. (This fires either due
> to this language change or due to pre-C++20 reasons for the member being
> implicitly deleted). I've tested this on a large codebase and found only
> bugs (where the program means something that's clearly different from
> what the programmer intended), so this is enabled by default, but we
> should revisit this if there are problems with this being enabled by
> default.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp
> cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
> cfe/trunk/test/CXX/drs/dr6xx.cpp
> cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp
> cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp
> cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp
> cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp
> cfe/trunk/test/SemaCUDA/implicit-member-target.cu
> cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
> cfe/trunk/test/SemaCXX/cxx17-compat.cpp
> cfe/trunk/test/SemaCXX/dr1301.cpp
> cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
> cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp
> cfe/trunk/www/cxx_status.html
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 27
> 18:16:43 2018
> @@ -7760,9 +7760,19 @@ def err_incorrect_defaulted_exception_sp
> def err_incorrect_defaulted_constexpr : Error<
> "defaulted definition of %sub{select_special_member_kind}0 "
> "is not constexpr">;
> +def warn_defaulted_method_deleted : Warning<
> + "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
> + "deleted">, InGroup<DiagGroup<"defaulted-function-deleted">>;
> def err_out_of_line_default_deletes : Error<
> "defaulting this %sub{select_special_member_kind}0 "
> "would delete it after its first declaration">;
> +def note_deleted_type_mismatch : Note<
> + "function is implicitly deleted because its declared type does not
> match "
> + "the type of an implicit %sub{select_special_member_kind}0">;
> +def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
> + "explicitly defaulting this %sub{select_special_member_kind}0 with a
> type "
> + "different from the implicit type is incompatible with C++ standards
> before "
> + "C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
> def warn_vbase_moved_multiple_times : Warning<
> "defaulted move assignment operator of %0 will move assign virtual base
> "
> "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
>
> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Sep 27 18:16:43 2018
> @@ -6451,20 +6451,29 @@ void Sema::CheckExplicitlyDefaultedSpeci
> // copy operation can take a non-const reference) as an implicit
> // declaration, and
> // -- not have default arguments.
> + // C++2a changes the second bullet to instead delete the function if
> it's
> + // defaulted on its first declaration, unless it's "an assignment
> operator,
> + // and its return type differs or its parameter type is not a
> reference".
> + bool DeleteOnTypeMismatch = getLangOpts().CPlusPlus2a && First;
> + bool ShouldDeleteForTypeMismatch = false;
> unsigned ExpectedParams = 1;
> if (CSM == CXXDefaultConstructor || CSM == CXXDestructor)
> ExpectedParams = 0;
> if (MD->getNumParams() != ExpectedParams) {
> - // This also checks for default arguments: a copy or move constructor
> with a
> + // This checks for default arguments: a copy or move constructor with
> a
> // default argument is classified as a default constructor, and
> assignment
> // operations and destructors can't have default arguments.
> Diag(MD->getLocation(), diag::err_defaulted_special_member_params)
> << CSM << MD->getSourceRange();
> HadError = true;
> } else if (MD->isVariadic()) {
> - Diag(MD->getLocation(), diag::err_defaulted_special_member_variadic)
> - << CSM << MD->getSourceRange();
> - HadError = true;
> + if (DeleteOnTypeMismatch)
> + ShouldDeleteForTypeMismatch = true;
> + else {
> + Diag(MD->getLocation(), diag::err_defaulted_special_member_variadic)
> + << CSM << MD->getSourceRange();
> + HadError = true;
> + }
> }
>
> const FunctionProtoType *Type =
> MD->getType()->getAs<FunctionProtoType>();
> @@ -6489,9 +6498,13 @@ void Sema::CheckExplicitlyDefaultedSpeci
>
> // A defaulted special member cannot have cv-qualifiers.
> if (Type->getTypeQuals()) {
> - Diag(MD->getLocation(), diag::err_defaulted_special_member_quals)
> - << (CSM == CXXMoveAssignment) << getLangOpts().CPlusPlus14;
> - HadError = true;
> + if (DeleteOnTypeMismatch)
> + ShouldDeleteForTypeMismatch = true;
> + else {
> + Diag(MD->getLocation(), diag::err_defaulted_special_member_quals)
> + << (CSM == CXXMoveAssignment) << getLangOpts().CPlusPlus14;
> + HadError = true;
> + }
> }
> }
>
> @@ -6504,23 +6517,30 @@ void Sema::CheckExplicitlyDefaultedSpeci
> HasConstParam = ReferentType.isConstQualified();
>
> if (ReferentType.isVolatileQualified()) {
> - Diag(MD->getLocation(),
> - diag::err_defaulted_special_member_volatile_param) << CSM;
> - HadError = true;
> + if (DeleteOnTypeMismatch)
> + ShouldDeleteForTypeMismatch = true;
> + else {
> + Diag(MD->getLocation(),
> + diag::err_defaulted_special_member_volatile_param) << CSM;
> + HadError = true;
> + }
> }
>
> if (HasConstParam && !CanHaveConstParam) {
> - if (CSM == CXXCopyConstructor || CSM == CXXCopyAssignment) {
> + if (DeleteOnTypeMismatch)
> + ShouldDeleteForTypeMismatch = true;
> + else if (CSM == CXXCopyConstructor || CSM == CXXCopyAssignment) {
> Diag(MD->getLocation(),
> diag::err_defaulted_special_member_copy_const_param)
> << (CSM == CXXCopyAssignment);
> // FIXME: Explain why this special member can't be const.
> + HadError = true;
> } else {
> Diag(MD->getLocation(),
> diag::err_defaulted_special_member_move_const_param)
> << (CSM == CXXMoveAssignment);
> + HadError = true;
> }
> - HadError = true;
> }
> } else if (ExpectedParams) {
> // A copy assignment operator can take its argument by value, but a
> @@ -6582,14 +6602,27 @@ void Sema::CheckExplicitlyDefaultedSpeci
> EPI));
> }
>
> - if (ShouldDeleteSpecialMember(MD, CSM)) {
> + if (ShouldDeleteForTypeMismatch || ShouldDeleteSpecialMember(MD, CSM)) {
> if (First) {
> SetDeclDeleted(MD, MD->getLocation());
> + if (!inTemplateInstantiation() && !HadError) {
> + Diag(MD->getLocation(), diag::warn_defaulted_method_deleted) <<
> CSM;
> + if (ShouldDeleteForTypeMismatch) {
> + Diag(MD->getLocation(), diag::note_deleted_type_mismatch) <<
> CSM;
> + } else {
> + ShouldDeleteSpecialMember(MD, CSM, nullptr, /*Diagnose*/true);
> + }
> + }
> + if (ShouldDeleteForTypeMismatch && !HadError) {
> + Diag(MD->getLocation(),
> + diag::warn_cxx17_compat_defaulted_method_type_mismatch) <<
> CSM;
> + }
> } else {
> // C++11 [dcl.fct.def.default]p4:
> // [For a] user-provided explicitly-defaulted function [...] if
> such a
> // function is implicitly defined as deleted, the program is
> ill-formed.
> Diag(MD->getLocation(), diag::err_out_of_line_default_deletes) <<
> CSM;
> + assert(!ShouldDeleteForTypeMismatch && "deleted non-first decl");
> ShouldDeleteSpecialMember(MD, CSM, nullptr, /*Diagnose*/true);
> HadError = true;
> }
>
> Modified: cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp (original)
> +++ cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp Thu Sep 27
> 18:16:43 2018
> @@ -44,8 +44,8 @@ struct G : D {};
> // expected-error at -3 {{deleted function 'operator=' cannot override a
> non-deleted function}}
> // expected-note at -4 {{while declaring the implicit move assignment
> operator for 'G'}}
> // expected-note at -5 {{move assignment operator of 'G' is implicitly
> deleted because base class 'D' has an inaccessible move assignment
> operator}}
> -struct H : D {
> - H &operator=(H&&) = default;
> +struct H : D { // expected-note {{deleted because base class 'D' has an
> inaccessible move assignment}}
> + H &operator=(H&&) = default; // expected-warning {{implicitly deleted}}
> // expected-error at -1 {{deleted function 'operator=' cannot override a
> non-deleted function}}
> // expected-note at -3 {{move assignment operator of 'H' is implicitly
> deleted because base class 'D' has an inaccessible move assignment
> operator}}
> ~H();
>
> Modified:
> cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
> (original)
> +++ cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp Thu
> Sep 27 18:16:43 2018
> @@ -1,15 +1,30 @@
> // RUN: %clang_cc1 -verify %s -std=c++11
> +// RUN: %clang_cc1 -verify %s -std=c++17
> +// RUN: %clang_cc1 -verify %s -std=c++2a
>
> // A function that is explicitly defaulted shall
> struct A {
> // -- be a special member function,
> A(int) = default; // expected-error {{only special member functions may
> be defaulted}}
> + A(A) = default; // expected-error {{must pass its first argument by
> reference}}
>
> // -- have the same declared function type as if it had been implicitly
> // declared
> void operator=(const A &) = default; // expected-error {{must return 'A
> &'}}
> - A(...) = default; // expected-error {{cannot be variadic}}
> - A(const A &, ...) = default; // expected-error {{cannot be variadic}}
> + A(...) = default;
> + A(const A &, ...) = default;
> + A &operator=(const A&) const = default;
> + A &operator=(A) const = default; // expected-error {{must be an lvalue
> refe}}
> +#if __cplusplus <= 201703L
> + // expected-error at -5 {{cannot be variadic}}
> + // expected-error at -5 {{cannot be variadic}}
> + // expected-error at -5 {{may not have 'const'}}
> + // expected-error at -5 {{may not have 'const'}}
> +#else
> + // expected-warning at -10 {{implicitly deleted}} expected-note at -10
> {{declared type does not match the type of an implicit default constructor}}
> + // expected-warning at -10 {{implicitly deleted}} expected-note at -10
> {{declared type does not match the type of an implicit copy constructor}}
> + // expected-warning at -10 {{implicitly deleted}} expected-note at -10
> {{declared type does not match the type of an implicit copy assignment}}
> +#endif
>
> // (except for possibly differing ref-qualifiers
> A &operator=(A &&) & = default;
> @@ -23,3 +38,35 @@ struct A {
> A(double = 0.0) = default; // expected-error {{cannot have default
> arguments}}
> A(const A & = 0) = default; // expected-error {{cannot have default
> arguments}}
> };
> +
> +struct A2 {
> + A2(...);
> + A2(const A2 &, ...);
> + A2 &operator=(const A2&) const;
> +};
> +A2::A2(...) = default; // expected-error {{cannot be variadic}}
> +A2::A2(const A2&, ...) = default; // expected-error {{cannot be variadic}}
> +A2 &A2::operator=(const A2&) const = default; // expected-error {{may not
> have 'const'}}
> +
> +struct B {
> + B(B&);
> + B &operator=(B&);
> +};
> +struct C : B {
> + C(const C&) = default;
> + C &operator=(const C&) = default;
> +#if __cplusplus <= 201703L
> + // expected-error at -3 {{is const, but a member or base requires it to
> be non-const}}
> + // expected-error at -3 {{is const, but a member or base requires it to
> be non-const}}
> +#else
> + // expected-warning at -6 {{implicitly deleted}} expected-note at -6 {{type
> does not match}}
> + // expected-warning at -6 {{implicitly deleted}} expected-note at -6 {{type
> does not match}}
> +#endif
> +};
> +
> +struct D : B { // expected-note 2{{base class}}
> + D(const D&);
> + D &operator=(const D&);
> +};
> +D::D(const D&) = default; // expected-error {{would delete}}
> expected-error {{is const, but}}
> +D &D::operator=(const D&) = default; // expected-error {{would delete}}
> expected-error {{is const, but}}
>
> Modified: cfe/trunk/test/CXX/drs/dr6xx.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr6xx.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/drs/dr6xx.cpp (original)
> +++ cfe/trunk/test/CXX/drs/dr6xx.cpp Thu Sep 27 18:16:43 2018
> @@ -757,8 +757,8 @@ namespace dr666 { // dr666: yes
> #if __cplusplus >= 201103L
> namespace dr667 { // dr667: yes
> struct A {
> - A() = default;
> - int &r;
> + A() = default; // expected-warning {{explicitly defaulted default
> constructor is implicitly deleted}}
> + int &r; // expected-note {{because field 'r' of reference type 'int
> &' would not be initialized}}
> };
> static_assert(!__is_trivially_constructible(A), "");
>
>
> Modified: cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp (original)
> +++ cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp Thu Sep 27 18:16:43
> 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -std=c++11 -verify %s
> +// RUN: %clang_cc1 -std=c++11 -verify %s -Wno-defaulted-function-deleted
>
> // expected-no-diagnostics
>
>
> Modified: cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp (original)
> +++ cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp Thu Sep 27
> 18:16:43 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -verify %s -std=c++11
> +// RUN: %clang_cc1 -verify %s -std=c++11 -Wno-defaulted-function-deleted
>
> struct Trivial {};
>
>
> Modified: cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp (original)
> +++ cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp Thu Sep 27 18:16:43
> 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
> +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
> -Wno-defaulted-function-deleted
>
> struct DefaultedDefCtor1 {};
> struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; };
>
> Modified: cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp (original)
> +++ cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp Thu Sep 27 18:16:43
> 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -verify -std=c++11 %s
> +// RUN: %clang_cc1 -verify -std=c++11 %s -Wno-defaulted-function-deleted
>
> struct NonTrivDtor {
> ~NonTrivDtor();
>
> Modified: cfe/trunk/test/SemaCUDA/implicit-member-target.cu
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCUDA/implicit-member-target.cu?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCUDA/implicit-member-target.cu (original)
> +++ cfe/trunk/test/SemaCUDA/implicit-member-target.cu Thu Sep 27 18:16:43
> 2018
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -std=gnu++11 -fsyntax-only -verify %s
> +// RUN: %clang_cc1 -std=gnu++11 -fsyntax-only -verify %s
> -Wno-defaulted-function-deleted
>
> #include "Inputs/cuda.h"
>
>
> Modified: cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp Thu Sep 27
> 18:16:43 2018
> @@ -59,7 +59,7 @@ struct good_const {
> good_const gc;
>
> struct no_default {
> - no_default() = delete; // expected-note 4{{deleted here}}
> + no_default() = delete; // expected-note 5{{deleted here}}
> };
> struct no_dtor {
> ~no_dtor() = delete; // expected-note 2{{deleted here}}
> @@ -108,8 +108,8 @@ struct has_friend {
> has_friend hf;
>
> struct defaulted_delete {
> - no_default nd; // expected-note {{because field 'nd' has a deleted
> default constructor}}
> - defaulted_delete() = default; // expected-note{{implicitly deleted
> here}}
> + no_default nd; // expected-note 2{{because field 'nd' has a deleted
> default constructor}}
> + defaulted_delete() = default; // expected-note{{implicitly deleted
> here}} expected-warning {{implicitly deleted}}
> };
> defaulted_delete dd; // expected-error {{call to implicitly-deleted
> default constructor}}
>
>
> Modified: cfe/trunk/test/SemaCXX/cxx17-compat.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx17-compat.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/cxx17-compat.cpp (original)
> +++ cfe/trunk/test/SemaCXX/cxx17-compat.cpp Thu Sep 27 18:16:43 2018
> @@ -1,5 +1,5 @@
> // RUN: %clang_cc1 -fsyntax-only -std=c++17 -pedantic -verify %s
> -// RUN: %clang_cc1 -fsyntax-only -std=c++2a -Wc++17-compat-pedantic
> -verify %s
> +// RUN: %clang_cc1 -fsyntax-only -std=c++2a -Wc++17-compat-pedantic
> -verify %s -Wno-defaulted-function-deleted
>
> struct A {};
> int (A::*pa)() const&;
> @@ -42,3 +42,15 @@ void copy_lambda() { Lambda = Lambda; }
> #else
> // expected-warning at -4 {{assignment of lambda is incompatible with
> C++ standards before C++2a}}
> #endif
> +
> +struct DefaultDeleteWrongTypeBase {
> + DefaultDeleteWrongTypeBase(DefaultDeleteWrongTypeBase&);
> +};
> +struct DefaultDeleteWrongType : DefaultDeleteWrongTypeBase {
> + DefaultDeleteWrongType(const DefaultDeleteWrongType&) = default;
> +#if __cplusplus <= 201703L
> + // expected-error at -2 {{a member or base requires it to be non-const}}
> +#else
> + // expected-warning at -4 {{explicitly defaulting this copy constructor
> with a type different from the implicit type is incompatible with C++
> standards before C++2a}}
> +#endif
> +};
>
> Modified: cfe/trunk/test/SemaCXX/dr1301.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dr1301.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/dr1301.cpp (original)
> +++ cfe/trunk/test/SemaCXX/dr1301.cpp Thu Sep 27 18:16:43 2018
> @@ -6,7 +6,7 @@ struct A { // expected-note 2{{candidate
> int a = A().n; // expected-error {{no matching constructor}}
>
> struct B {
> - B() = delete; // expected-note 3{{here}}
> + B() = delete; // expected-note 4{{here}}
> int n;
> };
> int b = B().n; // expected-error {{call to deleted}}
> @@ -17,8 +17,8 @@ struct C {
> int c = C().b.n; // expected-error {{call to implicitly-deleted default}}
>
> struct D {
> - D() = default; // expected-note {{here}}
> - B b; // expected-note {{'b' has a deleted default constructor}}
> + D() = default; // expected-note {{here}} expected-warning {{implicitly
> deleted}}
> + B b; // expected-note 2{{'b' has a deleted default constructor}}
> };
> int d = D().b.n; // expected-error {{call to implicitly-deleted default}}
>
>
> Modified: cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp (original)
> +++ cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp Thu Sep 27
> 18:16:43 2018
> @@ -6,8 +6,8 @@ struct S {
> void operator delete(void*, double);
> } s; // expected-error {{attempt to use a deleted function}}
>
> -struct T { // expected-note{{virtual destructor requires an unambiguous,
> accessible 'operator delete'}}
> - virtual ~T() = default; // expected-note {{explicitly defaulted
> function was implicitly deleted here}}
> +struct T { // expected-note 2{{virtual destructor requires an
> unambiguous, accessible 'operator delete'}}
> + virtual ~T() = default; // expected-note {{explicitly defaulted
> function was implicitly deleted here}} expected-warning {{implicitly
> deleted}}
> void operator delete(void*, int);
> void operator delete(void*, double);
> } t; // expected-error {{attempt to use a deleted function}}
>
> Modified: cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp (original)
> +++ cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp Thu Sep 27
> 18:16:43 2018
> @@ -1,5 +1,5 @@
> -// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
> -// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -DCXX_EXCEPTIONS
> -fsyntax-only -verify %s
> +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
> -Wno-defaulted-function-deleted
> +// RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -DCXX_EXCEPTIONS
> -fsyntax-only -verify %s -Wno-defaulted-function-deleted
>
> template <class _Tp> struct is_nothrow_move_constructible {
> static const bool value = false;
>
> Modified: cfe/trunk/www/cxx_status.html
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=343285&r1=343284&r2=343285&view=diff
>
> ==============================================================================
> --- cfe/trunk/www/cxx_status.html (original)
> +++ cfe/trunk/www/cxx_status.html Thu Sep 27 18:16:43 2018
> @@ -884,7 +884,7 @@ as the draft C++2a standard evolves.
> <tr>
> <td><tt>const</tt> mismatch with defaulted copy constructor</td>
> <td><a href="http://wg21.link/p0641r2">P0641R2</a></td>
> - <td class="none" align="center">No</td>
> + <td class="svn" align="center">SVN</td>
> </tr>
> <tr>
> <td rowspan="3">Consistent comparison
> (<tt>operator<=></tt>)</td>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180928/e7c47a38/attachment-0001.html>
More information about the cfe-commits
mailing list