[cfe-commits] r167510 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaTemplate/instantiate-attr.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Nov 6 16:35:20 PST 2012
Author: efriedma
Date: Tue Nov 6 18:35:20 2012
New Revision: 167510
URL: http://llvm.org/viewvc/llvm-project?rev=167510&view=rev
Log:
Add missing check to warning for packed attribute. PR14259.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaTemplate/instantiate-attr.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=167510&r1=167509&r2=167510&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Nov 6 18:35:20 2012
@@ -963,7 +963,8 @@
else if (FieldDecl *FD = dyn_cast<FieldDecl>(D)) {
// If the alignment is less than or equal to 8 bits, the packed attribute
// has no effect.
- if (!FD->getType()->isIncompleteType() &&
+ if (!FD->getType()->isDependentType() &&
+ !FD->getType()->isIncompleteType() &&
S.Context.getTypeAlign(FD->getType()) <= 8)
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored_for_field_of_type)
<< Attr.getName() << FD->getType();
Modified: cfe/trunk/test/SemaTemplate/instantiate-attr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-attr.cpp?rev=167510&r1=167509&r2=167510&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-attr.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-attr.cpp Tue Nov 6 18:35:20 2012
@@ -25,3 +25,12 @@
int test1[__builtin_offsetof(type, a) == 0 ? 1 : -1];
int test2[__builtin_offsetof(type, b) == 4 ? 1 : -1];
}
+
+namespace test2 {
+ template <class type>
+ struct fastscriptmember {
+ type Member __attribute__ ((packed));
+ char x;
+ };
+ int test0[sizeof(fastscriptmember<int>) == 5 ? 1 : -1];
+}
More information about the cfe-commits
mailing list