summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-15 23:18:36 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-15 23:18:36 +0000
commita02a72af8dac1aa3fac13aedb7f48c9a9b9ec8c0 (patch)
tree57073ff6795efe7a703b2ebbe6a7068201f6f7a3 /clang/lib/Sema/SemaDecl.cpp
parentd7f8bd1c1456976da87ead62f8f8596d56fd23ff (diff)
downloadbcm5719-llvm-a02a72af8dac1aa3fac13aedb7f48c9a9b9ec8c0.tar.gz
bcm5719-llvm-a02a72af8dac1aa3fac13aedb7f48c9a9b9ec8c0.zip
Check for unexpanded parameter packs in various kinds of
declarations. This is a work in progress, as I go through the C++ declaration grammar to identify where unexpanded parameter packs can occur. llvm-svn: 121912
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 6182e8663b4..5704cb5ad46 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6424,7 +6424,9 @@ bool Sema::VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
<< FieldName << FieldTy << BitWidth->getSourceRange();
return Diag(FieldLoc, diag::err_not_integral_type_anon_bitfield)
<< FieldTy << BitWidth->getSourceRange();
- }
+ } else if (DiagnoseUnexpandedParameterPack(const_cast<Expr *>(BitWidth),
+ UPPC_BitFieldWidth))
+ return true;
// If the bit-width is type- or value-dependent, don't try to check
// it now.
@@ -6499,9 +6501,17 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record,
TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
QualType T = TInfo->getType();
- if (getLangOptions().CPlusPlus)
+ if (getLangOptions().CPlusPlus) {
CheckExtraCXXDefaultArguments(D);
+ if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo,
+ UPPC_DataMemberType)) {
+ D.setInvalidType();
+ T = Context.IntTy;
+ TInfo = Context.getTrivialTypeSourceInfo(T, Loc);
+ }
+ }
+
DiagnoseFunctionSpecifiers(D);
if (D.getDeclSpec().isThreadSpecified())
OpenPOWER on IntegriCloud