llvm-project/clang/test/Misc/explicit.cpp
Gousemoodhin Nadaf fe86dbb32d [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
2020-08-20 18:15:43 -07:00

10 lines
455 B
C++

// 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}}
}