Instantiate attributes on typedefs. This is a quick fix for PR7148,

when we really need a proper audit of our handling of attributes in
templates.

llvm-svn: 103999
This commit is contained in:
Douglas Gregor 2010-05-17 23:46:49 +00:00
parent 93d8844699
commit 96cdb1590e
2 changed files with 7 additions and 0 deletions

View File

@ -217,6 +217,7 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) {
Typedef->setPreviousDeclaration(cast<TypedefDecl>(InstPrev));
}
InstantiateAttrs(D, Typedef);
Typedef->setAccess(D->getAccess());
Owner->addDecl(Typedef);

View File

@ -2,6 +2,12 @@
template <typename T>
struct A {
char a __attribute__((aligned(16)));
struct B {
typedef T __attribute__((aligned(16))) i16;
i16 x;
};
};
int a[sizeof(A<int>) == 16 ? 1 : -1];
int a2[sizeof(A<int>::B) == 16 ? 1 : -1];