[cfe-commits] r84914 - /cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
John McCall
rjmccall at apple.com
Thu Oct 22 16:33:21 PDT 2009
Author: rjmccall
Date: Thu Oct 22 18:33:21 2009
New Revision: 84914
URL: http://llvm.org/viewvc/llvm-project?rev=84914&view=rev
Log:
Preserve type source information when substituting into FieldDecls.
Just r84734 now that some fundamental work has been completed.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=84914&r1=84913&r2=84914&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Oct 22 18:33:21 2009
@@ -204,11 +204,14 @@
Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
bool Invalid = false;
- QualType T = D->getType();
- if (T->isDependentType()) {
- T = SemaRef.SubstType(T, TemplateArgs,
- D->getLocation(), D->getDeclName());
- if (!T.isNull() && T->isFunctionType()) {
+ DeclaratorInfo *DI = D->getDeclaratorInfo();
+ if (DI->getType()->isDependentType()) {
+ DI = SemaRef.SubstType(DI, TemplateArgs,
+ D->getLocation(), D->getDeclName());
+ if (!DI) {
+ DI = D->getDeclaratorInfo();
+ Invalid = true;
+ } else if (DI->getType()->isFunctionType()) {
// C++ [temp.arg.type]p3:
// If a declaration acquires a function type through a type
// dependent on a template-parameter and this causes a
@@ -216,8 +219,7 @@
// function declarator to have function type, the program is
// ill-formed.
SemaRef.Diag(D->getLocation(), diag::err_field_instantiates_to_function)
- << T;
- T = QualType();
+ << DI->getType();
Invalid = true;
}
}
@@ -238,8 +240,8 @@
BitWidth = InstantiatedBitWidth.takeAs<Expr>();
}
- FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(), T,
- D->getDeclaratorInfo(),
+ FieldDecl *Field = SemaRef.CheckFieldDecl(D->getDeclName(),
+ DI->getType(), DI,
cast<RecordDecl>(Owner),
D->getLocation(),
D->isMutable(),
More information about the cfe-commits
mailing list