blob: 42b868f574d56df9429f7d094c9516daf0cd23d7 [file] [log] [blame]
Douglas Gregorc4633352010-12-15 17:38:57 +00001//===------- SemaTemplateVariadic.cpp - C++ Variadic Templates ------------===/
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//===----------------------------------------------------------------------===/
8//
9// This file implements semantic analysis for C++0x variadic templates.
10//===----------------------------------------------------------------------===/
11
12#include "clang/Sema/Sema.h"
13#include "clang/Sema/SemaInternal.h"
14#include "clang/AST/Expr.h"
15#include "clang/AST/TypeLoc.h"
16
17using namespace clang;
18
19bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc,
20 TypeSourceInfo *T,
21 UnexpandedParameterPackContext UPPC) {
22 // C++0x [temp.variadic]p5:
23 // An appearance of a name of a parameter pack that is not expanded is
24 // ill-formed.
25 if (!T->getType()->containsUnexpandedParameterPack())
26 return false;
27
28 // FIXME: Provide the names and locations of the unexpanded parameter packs.
29 Diag(Loc, diag::err_unexpanded_parameter_pack)
30 << (int)UPPC << T->getTypeLoc().getSourceRange();
31 return true;
32}
33
34bool Sema::DiagnoseUnexpandedParameterPack(Expr *E,
35 UnexpandedParameterPackContext UPPC) {
36 // C++0x [temp.variadic]p5:
37 // An appearance of a name of a parameter pack that is not expanded is
38 // ill-formed.
39 if (!E->containsUnexpandedParameterPack())
40 return false;
41
42 // FIXME: Provide the names and locations of the unexpanded parameter packs.
43 Diag(E->getSourceRange().getBegin(), diag::err_unexpanded_parameter_pack)
44 << (int)UPPC << E->getSourceRange();
45 return true;
46}