aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-21 02:42:37 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-21 02:42:37 +0000
commit71e2bf960105daeb3b6f7005e73885b790b2a1b1 (patch)
tree1739241a33efaf7db1b4929328e76411facd11b9 /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent0a5fa06a688e1086ea553a24b42b9915996ed1f7 (diff)
Preserve type source information when substituting into FieldDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 0a75383842..14d8c35485 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -204,11 +204,11 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
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->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
@@ -238,8 +238,8 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) {
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(),