diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-05-24 17:22:01 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-05-24 17:22:01 +0000 |
commit | 836adf6771d5170d936599dfcce21687e37e9bbf (patch) | |
tree | f4e55e181309cece8d807605f492d96b601f4c91 /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 94a615718d06704816c6e31a811f823c05e39f52 (diff) |
Make sure that we instantiate variably modified types, even if they
aren't dependent. Fixes <rdar://problem/8020206>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 0e4dfcb14c..1adf594c1e 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -627,7 +627,7 @@ bool TemplateInstantiator::AlreadyTransformed(QualType T) { if (T.isNull()) return true; - if (T->isDependentType()) + if (T->isDependentType() || T->isVariablyModifiedType()) return false; getSema().MarkDeclarationsReferencedInType(Loc, T); @@ -942,7 +942,8 @@ TypeSourceInfo *Sema::SubstType(TypeSourceInfo *T, "Cannot perform an instantiation without some context on the " "instantiation stack"); - if (!T->getType()->isDependentType()) + if (!T->getType()->isDependentType() && + !T->getType()->isVariablyModifiedType()) return T; TemplateInstantiator Instantiator(*this, Args, Loc, Entity); @@ -957,8 +958,9 @@ QualType Sema::SubstType(QualType T, "Cannot perform an instantiation without some context on the " "instantiation stack"); - // If T is not a dependent type, there is nothing to do. - if (!T->isDependentType()) + // If T is not a dependent type or a variably-modified type, there + // is nothing to do. + if (!T->isDependentType() && !T->isVariablyModifiedType()) return T; TemplateInstantiator Instantiator(*this, TemplateArgs, Loc, Entity); @@ -966,7 +968,7 @@ QualType Sema::SubstType(QualType T, } static bool NeedsInstantiationAsFunctionType(TypeSourceInfo *T) { - if (T->getType()->isDependentType()) + if (T->getType()->isDependentType() || T->getType()->isVariablyModifiedType()) return true; TypeLoc TL = T->getTypeLoc(); |