Address more comments from Doug.

llvm-svn: 73267
This commit is contained in:
Anders Carlsson 2009-06-12 23:09:56 +00:00
parent 815b70efcd
commit f986ba7528
3 changed files with 17 additions and 6 deletions

View File

@ -256,6 +256,9 @@ def err_typename_refers_to_non_type_template : Error<
def err_expected_type_name_after_typename : Error< def err_expected_type_name_after_typename : Error<
"expected an identifier or template-id after '::'">; "expected an identifier or template-id after '::'">;
def err_variadic_templates : Error<
"variadic templates are only allowed in C++0x">;
// Language specific pragmas // Language specific pragmas
// - Generic warnings // - Generic warnings
def warn_pragma_expected_lparen : Warning< def warn_pragma_expected_lparen : Warning<

View File

@ -290,11 +290,11 @@ Parser::ParseTemplateParameterList(unsigned Depth,
/// parameter-declaration /// parameter-declaration
/// ///
/// type-parameter: (see below) /// type-parameter: (see below)
/// 'class' ...[opt] identifier[opt] /// 'class' ...[opt][C++0x] identifier[opt]
/// 'class' identifier[opt] '=' type-id /// 'class' identifier[opt] '=' type-id
/// 'typename' ...[opt] identifier[opt] /// 'typename' ...[opt][C++0x] identifier[opt]
/// 'typename' identifier[opt] '=' type-id /// 'typename' identifier[opt] '=' type-id
/// 'template' ...[opt] '<' template-parameter-list '>' 'class' identifier[opt] /// 'template' ...[opt][C++0x] '<' template-parameter-list '>' 'class' identifier[opt]
/// 'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression /// 'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
Parser::DeclPtrTy Parser::DeclPtrTy
Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) { Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
@ -319,9 +319,9 @@ Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
/// ParseTemplateTemplateParameter and ParseNonTypeTemplateParameter. /// ParseTemplateTemplateParameter and ParseNonTypeTemplateParameter.
/// ///
/// type-parameter: [C++ temp.param] /// type-parameter: [C++ temp.param]
/// 'class' ...[opt] identifier[opt] /// 'class' ...[opt][C++0x] identifier[opt]
/// 'class' identifier[opt] '=' type-id /// 'class' identifier[opt] '=' type-id
/// 'typename' ...[opt] identifier[opt] /// 'typename' ...[opt][C++0x] identifier[opt]
/// 'typename' identifier[opt] '=' type-id /// 'typename' identifier[opt] '=' type-id
Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) && assert((Tok.is(tok::kw_class) || Tok.is(tok::kw_typename)) &&
@ -334,9 +334,12 @@ Parser::DeclPtrTy Parser::ParseTypeParameter(unsigned Depth, unsigned Position){
// Grab the ellipsis (if given). // Grab the ellipsis (if given).
bool Ellipsis = false; bool Ellipsis = false;
SourceLocation EllipsisLoc; SourceLocation EllipsisLoc;
if (getLang().CPlusPlus0x && Tok.is(tok::ellipsis)) { if (Tok.is(tok::ellipsis)) {
Ellipsis = true; Ellipsis = true;
EllipsisLoc = ConsumeToken(); EllipsisLoc = ConsumeToken();
if (!getLang().CPlusPlus0x)
Diag(EllipsisLoc, diag::err_variadic_templates);
} }
// Grab the template parameter name (if given) // Grab the template parameter name (if given)

View File

@ -0,0 +1,5 @@
// RUN: clang-cc -fsyntax-only -verify %s
// Type parameter packs.
template <typename ... > struct T1 {}; // expected-error{{variadic templates are only allowed in C++0x}}