diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-06-25 22:19:48 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-06-25 22:19:48 +0000 |
commit | 7a08bd78a5be9410fa910961f001e157f68f2e6f (patch) | |
tree | 320b485d5c50cea95dba1bcd3fc6130a451b3035 /lib/Sema/SemaTemplate.cpp | |
parent | 85fb905d517e07b0322fee8236e7b3314fb799aa (diff) |
Don't allow dllimport variables in constant initializers
This is a follow-up to David's r211677. For the following code,
we would end up referring to 'foo' in the initializer for 'arr',
and then fail to link, because 'foo' is dllimport and needs to be
accessed through the __imp_?foo.
__declspec(dllimport) extern const char foo[];
const char* f() {
static const char* const arr[] = { foo };
return arr[0];
}
Differential Revision: http://reviews.llvm.org/D4299
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 84c58d12ea..00d93f8528 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4193,7 +4193,7 @@ isNullPointerValueTemplateArgument(Sema &S, NonTypeTemplateParmDecl *Param, if (Arg->isValueDependent() || Arg->isTypeDependent()) return NPV_NotNullPointer; - if (!S.getLangOpts().CPlusPlus11) + if (!S.getLangOpts().CPlusPlus11 || S.getLangOpts().MSVCCompat) return NPV_NotNullPointer; // Determine whether we have a constant expression. |