Author: Timm Bäder
Date: 2024-02-07T14:24:37+01:00
New Revision: b0c6fc81fe132f20eed38bd836620dfcb5ac17e9

URL: 
https://github.com/llvm/llvm-project/commit/b0c6fc81fe132f20eed38bd836620dfcb5ac17e9
DIFF: 
https://github.com/llvm/llvm-project/commit/b0c6fc81fe132f20eed38bd836620dfcb5ac17e9.diff

LOG: [clang][Interp] Ignore UsingEnumDecls

We previously aborted compilation when seeing one of them. Ignore
them instead, they have no effect on the generated bytecode.

Added: 
    

Modified: 
    clang/lib/AST/Interp/ByteCodeStmtGen.cpp
    clang/test/SemaCXX/cxx20-using-enum.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp 
b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
index a2d8c4e13010c6..b0ec90a1f2851c 100644
--- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp
@@ -317,7 +317,7 @@ bool ByteCodeStmtGen<Emitter>::visitCompoundStmt(
 template <class Emitter>
 bool ByteCodeStmtGen<Emitter>::visitDeclStmt(const DeclStmt *DS) {
   for (auto *D : DS->decls()) {
-    if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl>(D))
+    if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, UsingEnumDecl>(D))
       continue;
 
     const auto *VD = dyn_cast<VarDecl>(D);

diff  --git a/clang/test/SemaCXX/cxx20-using-enum.cpp 
b/clang/test/SemaCXX/cxx20-using-enum.cpp
index 872353aad8a0d4..d16df4e1b9d3cd 100644
--- a/clang/test/SemaCXX/cxx20-using-enum.cpp
+++ b/clang/test/SemaCXX/cxx20-using-enum.cpp
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s 
-fexperimental-new-constant-interpreter
+// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s 
-fexperimental-new-constant-interpreter
 
 // p1099 'using enum ELABORATED-ENUM-SPECIFIER ;'
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to