diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-15 23:18:36 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-15 23:18:36 +0000 |
commit | e186269a8a41dbff1ebea2c251048892979d1078 (patch) | |
tree | cfb98507042508e78bcd362f08456fe2c7e1f342 /lib/Sema/SemaDecl.cpp | |
parent | c11e1d7f1eff113b8a4b2a6370975eb1dc7c9205 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 6182e8663b..5704cb5ad4 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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()) |