[PATCH] D83929: [clang]: Remove assertion which checks explicit declaration

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 18:16:05 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGfe86dbb32da2: [clang]:  Remove assertion which checks explicit declaration (authored by gousemoodhin, committed by rsmith).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83929/new/

https://reviews.llvm.org/D83929

Files:
  clang/lib/Sema/DeclSpec.cpp
  clang/test/Misc/explicit.cpp


Index: clang/test/Misc/explicit.cpp
===================================================================
--- /dev/null
+++ 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 at -1{{'explicit' can only appear on non-static member functions}}
+                     // expected-error at -2{{use of undeclared label 'b'}}
+                     // expected-warning at -3{{declaration does not declare anything}}
+}
Index: clang/lib/Sema/DeclSpec.cpp
===================================================================
--- clang/lib/Sema/DeclSpec.cpp
+++ clang/lib/Sema/DeclSpec.cpp
@@ -1014,9 +1014,6 @@
                                        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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83929.286932.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200821/39cfb8f3/attachment.bin>


More information about the cfe-commits mailing list