"parameter%select{| pack}1 declared here">;
def err_unexpanded_parameter_pack_0 : Error<
- "%select{expression|base type|declaration type|template argument}0 contains "
- "unexpanded parameter pack">;
+ "%select{expression|base type|declaration type|data member type|bit-field "
+ "size}0 "
+ "contains unexpanded parameter pack">;
def err_unexpanded_parameter_pack_1 : Error<
- "%select{expression|base type|declaration type|template argument}0 contains "
- "unexpanded parameter pack %1">;
+ "%select{expression|base type|declaration type|data member type|bit-field "
+ "size}0 "
+ "contains unexpanded parameter pack %1">;
def err_unexpanded_parameter_pack_2 : Error<
- "%select{expression|base type|declaration type|template argument}0 contains "
- "unexpanded parameter packs %1 and %2">;
+ "%select{expression|base type|declaration type|data member type|bit-field "
+ "size}0 "
+ "contains unexpanded parameter packs %1 and %2">;
def err_unexpanded_parameter_pack_3_or_more : Error<
- "%select{expression|base type|declaration type|template argument}0 contains "
- "unexpanded parameter packs %1, %2, ...">;
+ "%select{expression|base type|declaration type|data member type|bit-field "
+ "size}0 "
+ "contains unexpanded parameter packs %1, %2, ...">;
def err_unexpected_typedef : Error<
"unexpected type name %0: expected expression">;
/// Note that the values of this enumeration line up with the first
/// argument to the \c err_unexpanded_parameter_pack diagnostic.
enum UnexpandedParameterPackContext {
+ /// \brief An arbitrary expression.
UPPC_Expression = 0,
+
+ /// \brief The base type of a class type.
UPPC_BaseType,
+
+ /// \brief The type of an arbitrary declaration.
UPPC_DeclarationType,
- UPPC_TemplateArgument
+
+ /// \brief The type of a data member.
+ UPPC_DataMemberType,
+
+ /// \brief The size of a bit-field.
+ UPPC_BitFieldWidth
};
/// \brief If the given type contains an unexpanded parameter pack,
// Fill in the exception array.
QualType *exnSlot = argSlot + numArgs;
- for (unsigned i = 0, e = epi.NumExceptions; i != e; ++i)
+ for (unsigned i = 0, e = epi.NumExceptions; i != e; ++i) {
+ if (epi.Exceptions[i]->isDependentType())
+ setDependent();
+
+ if (epi.Exceptions[i]->containsUnexpandedParameterPack())
+ setContainsUnexpandedParameterPack();
+
exnSlot[i] = epi.Exceptions[i];
+ }
}
<< 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.
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())
// ObjCObjectPointerType is uninteresting
};
+// FIXME: Test for unexpanded parameter packs in each of the expression nodes.
+
template<typename ... Types>
void TestPPNameFunc(int i) {
f(static_cast<Types>(i)); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
}
+// FIXME: Test for unexpanded parameter packs in declarations.
+template<typename... Types>
+struct TestUnexpandedDecls {
+ void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ void member_function () throw(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}}
+ static Types static_data_member; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+ unsigned bit_field : static_cast<Types>(0); // expected-error{{bit-field size contains unexpanded parameter pack 'Types'}}
+};
+
+// Test for diagnostics in the presence of multiple unexpanded
+// parameter packs.
template<typename T, typename U> struct pair;
template<typename ...OuterTypes>
};
};
};
+