forked from OSchip/llvm-project
parent
b44c26b7aa
commit
5140b3c4a6
|
@ -365,14 +365,12 @@ void Parser::ParseDecltypeSpecifier(DeclSpec &DS) {
|
|||
SourceLocation StartLoc = ConsumeToken();
|
||||
SourceLocation LParenLoc = Tok.getLocation();
|
||||
|
||||
|
||||
if (ExpectAndConsume(tok::l_paren, diag::err_expected_lparen_after,
|
||||
"decltype")) {
|
||||
SkipUntil(tok::r_paren);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Parse the expression
|
||||
|
||||
// C++0x [dcl.type.simple]p4:
|
||||
|
|
|
@ -560,6 +560,11 @@ TemplateTypeInstantiator::InstantiateTypeOfType(const TypeOfType *T,
|
|||
QualType
|
||||
TemplateTypeInstantiator::InstantiateDecltypeType(const DecltypeType *T,
|
||||
unsigned Quals) const {
|
||||
// C++0x [dcl.type.simple]p4:
|
||||
// The operand of the decltype specifier is an unevaluated operand.
|
||||
EnterExpressionEvaluationContext Unevaluated(SemaRef,
|
||||
Action::Unevaluated);
|
||||
|
||||
Sema::OwningExprResult E
|
||||
= SemaRef.InstantiateExpr(T->getUnderlyingExpr(), TemplateArgs);
|
||||
|
||||
|
|
|
@ -119,6 +119,14 @@ TemplateExprInstantiator::VisitDeclRefExpr(DeclRefExpr *E) {
|
|||
// FIXME: Clone the expression!
|
||||
return SemaRef.Owned(Arg.getAsExpr());
|
||||
|
||||
if (Arg.getKind() == TemplateArgument::Declaration) {
|
||||
ValueDecl *VD = cast<ValueDecl>(Arg.getAsDecl());
|
||||
|
||||
// FIXME: Can VD ever have a dependent type?
|
||||
return SemaRef.BuildDeclRefExpr(VD, VD->getType(), E->getLocation(),
|
||||
false, false);
|
||||
}
|
||||
|
||||
assert(Arg.getKind() == TemplateArgument::Integral);
|
||||
QualType T = Arg.getIntegralType();
|
||||
if (T->isCharType() || T->isWideCharType())
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
|
||||
|
||||
template< typename T, T t, decltype(t+2) v >
|
||||
struct Convoluted {};
|
||||
|
||||
int test_array[5];
|
||||
|
||||
Convoluted< int *, test_array, nullptr > tarray;
|
Loading…
Reference in New Issue