aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-23 19:57:01 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-23 19:57:01 +0000
commita481ec4150ad203440852a2bfee0883dd26f7530 (patch)
tree5b39dca0a86ea1a9747f4731470c78b761efaba7 /lib/Sema/SemaType.cpp
parent9ba6af8bedba28d10a6906c62c19d43f81c5d386 (diff)
It turns out that people love using VLAs in templates, too. Weaken our
VLA restrictions so that one can use VLAs in templates (even accidentally), but not as part of a non-type template parameter (which would be very bad). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index b25d076359..ea2b2e6812 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -716,15 +716,11 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
<< Context.getBaseElementType(T);
return QualType();
}
- // Prohibit the use of VLAs in template instantiations, since we don't
- // want them to accidentally be used. This means that we handle VLAs in
- // C-like contexts, but still ban them from C++-specific contexts.
- // And, since we check template definitions early, prohibit them there,
- // too.
- else if (CurContext->isDependentContext() ||
- ActiveTemplateInstantiations.size())
- Diag(Loc, diag::err_vla_in_template)
- << !CurContext->isDependentContext();
+ // Prohibit the use of VLAs during template argument deduction.
+ else if (isSFINAEContext()) {
+ Diag(Loc, diag::err_vla_in_sfinae);
+ return QualType();
+ }
// Just extwarn about VLAs.
else
Diag(Loc, diag::ext_vla);