Skip to content

Commit 77ec128

Browse files
committed
[clang][bytecode] Handle UsingDirectiveDecls
By ignoring them.
1 parent d21b2e6 commit 77ec128

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5096,7 +5096,7 @@ template <class Emitter>
50965096
bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
50975097
for (const auto *D : DS->decls()) {
50985098
if (isa<StaticAssertDecl, TagDecl, TypedefNameDecl, BaseUsingDecl,
5099-
FunctionDecl, NamespaceAliasDecl>(D))
5099+
FunctionDecl, NamespaceAliasDecl, UsingDirectiveDecl>(D))
51005100
continue;
51015101

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

clang/test/AST/ByteCode/literals.cpp

Lines changed: 11 additions & 0 deletions
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)