diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-09 03:59:21 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-09 03:59:21 +0000 |
commit | 76b9027f352a83c13c98820724071c5e3bea6232 (patch) | |
tree | 7319685297e02f0aad25f181838fda329b6cb331 /clang/test/SemaCXX/explicit.cpp | |
parent | ac0456594b0815b5390f5c7f1d2f16de074222e6 (diff) | |
download | bcm5719-llvm-76b9027f352a83c13c98820724071c5e3bea6232.tar.gz bcm5719-llvm-76b9027f352a83c13c98820724071c5e3bea6232.zip |
[c++20] Add support for explicit(bool), as described in P0892R2.
Patch by Tyker!
Differential Revision: https://reviews.llvm.org/D60934
llvm-svn: 360311
Diffstat (limited to 'clang/test/SemaCXX/explicit.cpp')
-rw-r--r-- | clang/test/SemaCXX/explicit.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/explicit.cpp b/clang/test/SemaCXX/explicit.cpp index a3902e5d10f..58760d347f0 100644 --- a/clang/test/SemaCXX/explicit.cpp +++ b/clang/test/SemaCXX/explicit.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s + namespace Constructor { struct A { A(int); @@ -34,6 +36,21 @@ B &&b3(0); // expected-error {{could not bind}} B b4{0}; B &&b5 = {0}; // expected-error {{chosen constructor is explicit}} B &&b6{0}; + +struct S { + template <bool b = true> + explicit S(); +}; + +struct T : S { + // T(); +}; + +struct U : T { + U(); +}; +U::U() {} + } namespace Conversion { @@ -183,7 +200,8 @@ namespace Conversion { const int ©List7 = {b}; const int ©List8 = {n}; // expected-error {{no viable conversion}} } - + +#if __cplusplus < 201707L void testNew() { // 5.3.4p6: @@ -200,7 +218,8 @@ namespace Conversion { new int[i]; new int[ni]; // expected-error {{array size expression of type 'NotInt' requires explicit conversion to type 'int'}} } - +#endif + void testDelete() { // 5.3.5pp2: |