diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2018-03-20 03:27:44 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2018-03-20 03:27:44 +0000 |
commit | 18b28a86c1bcf167ca7c53e94cdb4e2c2463c804 (patch) | |
tree | 7b4830889dd68d77acd3ad3faefaccbc764a3177 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 3e9462607e05b6a0b943d7bd4fb178ed5e44660a (diff) | |
download | bcm5719-llvm-18b28a86c1bcf167ca7c53e94cdb4e2c2463c804.tar.gz bcm5719-llvm-18b28a86c1bcf167ca7c53e94cdb4e2c2463c804.zip |
Properly construct `inline` members without initializers
Digging through commit logs, it appears the checks in this block predate
`inline` class variables. With them, we fail to emit dynamic
initializers for members that don't have an explicit initializer, and we
won't go out of our way to instantiate the class denoted by
`Var->getType()`.
Fixes PR35599.
llvm-svn: 327945
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 6f04dedeed5..3cc37d086ab 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4202,7 +4202,9 @@ void Sema::InstantiateVariableInitializer( Var->setInvalidDecl(); } } else { - if (Var->isStaticDataMember()) { + // `inline` variables are a definition and declaration all in one; we won't + // pick up an initializer from anywhere else. + if (Var->isStaticDataMember() && !Var->isInline()) { if (!Var->isOutOfLine()) return; |