[cfe-commits] r104545 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaTemplate/enum-argument.cpp
Douglas Gregor
dgregor at apple.com
Mon May 24 13:13:53 PDT 2010
Author: dgregor
Date: Mon May 24 15:13:53 2010
New Revision: 104545
URL: http://llvm.org/viewvc/llvm-project?rev=104545&view=rev
Log:
A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaTemplate/enum-argument.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=104545&r1=104544&r2=104545&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon May 24 15:13:53 2010
@@ -2729,6 +2729,9 @@
/// \returns the type this bit-field will promote to, or NULL if no
/// promotion occurs.
QualType ASTContext::isPromotableBitField(Expr *E) {
+ if (E->isTypeDependent() || E->isValueDependent())
+ return QualType();
+
FieldDecl *Field = E->getBitField();
if (!Field)
return QualType();
Modified: cfe/trunk/test/SemaTemplate/enum-argument.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/enum-argument.cpp?rev=104545&r1=104544&r2=104545&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/enum-argument.cpp (original)
+++ cfe/trunk/test/SemaTemplate/enum-argument.cpp Mon May 24 15:13:53 2010
@@ -21,3 +21,16 @@
};
X0<int> x0i;
+
+namespace rdar8020920 {
+ template<typename T>
+ struct X {
+ enum { e0 = 32 };
+
+ unsigned long long bitfield : e0;
+
+ void f(int j) {
+ bitfield + j;
+ }
+ };
+}
More information about the cfe-commits
mailing list