Skip to content

Commit 6e47330

Browse files
committed
[clang][Interp] Ignore FunctionDecls in compound statements
1 parent 959d98c commit 6e47330

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/AST/Interp/ByteCodeStmtGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ bool ByteCodeStmtGen<Emitter>::visitCompoundStmt(
332332
template <class Emitter>
333333
bool ByteCodeStmtGen<Emitter>::visitDeclStmt(const DeclStmt *DS) {
334334
for (auto *D : DS->decls()) {
335-
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, UsingEnumDecl>(D))
335+
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, UsingEnumDecl,
336+
FunctionDecl>(D))
336337
continue;
337338

338339
const auto *VD = dyn_cast<VarDecl>(D);

clang/test/AST/Interp/functions.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,13 @@ namespace FromIntegral {
601601
// both-warning {{variable length arrays}}
602602
#endif
603603
}
604+
605+
namespace {
606+
template <typename T> using id = T;
607+
template <typename T>
608+
constexpr void g() {
609+
constexpr id<void (T)> f;
610+
}
611+
612+
static_assert((g<int>(), true), "");
613+
}

0 commit comments

Comments
 (0)