aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/DeclSpec.cpp3
-rw-r--r--clang/test/Misc/explicit.cpp9
2 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp
index f553b5c..a3f770b 100644
--- a/clang/lib/Sema/DeclSpec.cpp
+++ b/clang/lib/Sema/DeclSpec.cpp
@@ -1014,9 +1014,6 @@ bool DeclSpec::setFunctionSpecExplicit(SourceLocation Loc,
const char *&PrevSpec, unsigned &DiagID,
ExplicitSpecifier ExplicitSpec,
SourceLocation CloseParenLoc) {
- assert((ExplicitSpec.getKind() == ExplicitSpecKind::ResolvedTrue ||
- ExplicitSpec.getExpr()) &&
- "invalid ExplicitSpecifier");
// 'explicit explicit' is ok, but warn as this is likely not what the user
// intended.
if (hasExplicitSpecifier()) {
diff --git a/clang/test/Misc/explicit.cpp b/clang/test/Misc/explicit.cpp
new file mode 100644
index 0000000..b544fc4
--- /dev/null
+++ b/clang/test/Misc/explicit.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++20 %s -verify
+
+int foo () {
+ int b;
+ explicit( && b ); // expected-error{{conversion from 'void *' to 'bool' is not allowed in a converted constant expression}}
+ // expected-error@-1{{'explicit' can only appear on non-static member functions}}
+ // expected-error@-2{{use of undeclared label 'b'}}
+ // expected-warning@-3{{declaration does not declare anything}}
+}