From a02a72af8dac1aa3fac13aedb7f48c9a9b9ec8c0 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 15 Dec 2010 23:18:36 +0000 Subject: 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 --- clang/lib/Sema/SemaDecl.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') 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(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()) -- cgit v1.2.3