Skip to content

Commit c9bac6e

Browse files
committed
Allow non-extern global variables without initializer
1 parent 78ec8c6 commit c9bac6e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cpp2rust/converter/converter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ bool Converter::ConvertVarDeclSkipInit(clang::VarDecl *decl) {
381381

382382
if (decl->isFileVarDecl()) {
383383
name = ReplaceAll(Mapper::ToString(decl), "::", "_");
384-
if ((decl->isExternallyDeclarable() && !decl->hasInit()) ||
384+
if (decl->isThisDeclarationADefinition() ==
385+
clang::VarDecl::DeclarationOnly ||
385386
!globals_.insert(name).second) {
386387
return false;
387388
}

0 commit comments

Comments
 (0)