summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/explicit.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:59:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-05-09 03:59:21 +0000
commit76b9027f352a83c13c98820724071c5e3bea6232 (patch)
tree7319685297e02f0aad25f181838fda329b6cb331 /clang/test/SemaCXX/explicit.cpp
parentac0456594b0815b5390f5c7f1d2f16de074222e6 (diff)
downloadbcm5719-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.cpp23
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 &copyList7 = {b};
const int &copyList8 = {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:
OpenPOWER on IntegriCloud