Skip to content

Commit 3e999bb

Browse files
authored
[clang][bytecode] Use first FieldDecl instead of asserting (llvm#104760)
This assertion fails sometimes. We use the first decl for lookup later, so let's use the first decl here as well.
1 parent 50daa23 commit 3e999bb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/AST/ByteCode/Program.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
329329
// Reserve space for fields.
330330
Record::FieldList Fields;
331331
for (const FieldDecl *FD : RD->fields()) {
332-
assert(FD == FD->getFirstDecl());
332+
FD = FD->getFirstDecl();
333333
// Note that we DO create fields and descriptors
334334
// for unnamed bitfields here, even though we later ignore
335335
// them everywhere. That's so the FieldDecl's getFieldIndex() matches.

clang/test/Modules/merge-using-decls.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify %s -DORDER=2
77
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=2
88
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2
9-
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2
9+
10+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2
1011

1112
#if ORDER == 1
1213
#include "a.h"

0 commit comments

Comments
 (0)