[clang]: Remove assertion which checks explicit declaration
explicit keyword is declared outside of class is invalid, invalid explicit declaration is handled inside DiagnoseFunctionSpecifiers() function. To avoid compiler crash in case of invalid explicit declaration, remove assertion. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D83929
This commit is contained in:
parent
95e18b2d9d
commit
fe86dbb32d
|
@ -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()) {
|
||||
|
|
|
@ -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}}
|
||||
}
|
Loading…
Reference in New Issue