Skip to content

Commit 47f4113

Browse files
author
git apple-llvm automerger
committed
Merge commit 'bb770deb9acf' from llvm.org/main into next
2 parents 255bd37 + bb770de commit 47f4113

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,9 @@ bool ByteCodeExprGen<Emitter>::visitArrayElemInit(unsigned ElemIndex,
11141114

11151115
template <class Emitter>
11161116
bool ByteCodeExprGen<Emitter>::VisitInitListExpr(const InitListExpr *E) {
1117+
if (E->getType()->isVoidType())
1118+
return this->emitInvalid(E);
1119+
11171120
// Handle discarding first.
11181121
if (DiscardResult) {
11191122
for (const Expr *Init : E->inits()) {

clang/test/AST/Interp/functions.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,3 +611,9 @@ namespace {
611611

612612
static_assert((g<int>(), true), "");
613613
}
614+
615+
namespace {
616+
/// The InitListExpr here is of void type.
617+
void bir [[clang::annotate("B", {1, 2, 3, 4})]] (); // both-error {{'annotate' attribute requires parameter 1 to be a constant expression}} \
618+
// both-note {{subexpression not valid in a constant expression}}
619+
}

0 commit comments

Comments
 (0)