Skip to content

Commit a955426

Browse files
authored
[clang][bytecode] Handle UsingDirectiveDecls (#128888)
By ignoring them.
1 parent bb62af7 commit a955426

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5107,7 +5107,7 @@ template <class Emitter>
51075107
bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
51085108
for (const auto *D : DS->decls()) {
51095109
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, BaseUsingDecl,
5110-
FunctionDecl, NamespaceAliasDecl>(D))
5110+
FunctionDecl, NamespaceAliasDecl, UsingDirectiveDecl>(D))
51115111
continue;
51125112

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

clang/test/AST/ByteCode/literals.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1330,3 +1330,14 @@ void localConstexpr() {
13301330
static_assert(a == 0, ""); // both-error {{not an integral constant expression}} \
13311331
// both-note {{initializer of 'a' is not a constant expression}}
13321332
}
1333+
1334+
namespace Foo {
1335+
namespace Bar {
1336+
constexpr int FB = 10;
1337+
}
1338+
}
1339+
constexpr int usingDirectiveDecl() {
1340+
using namespace Foo::Bar;
1341+
return FB;
1342+
}
1343+
static_assert(usingDirectiveDecl() == 10, "");

0 commit comments

Comments
 (0)