A type- or value-dependent expression cannot use bitfield

promotion. Fixes <rdar://problem/8020920>.

llvm-svn: 104545
This commit is contained in:
Douglas Gregor 2010-05-24 20:13:53 +00:00
parent 722bff2c7d
commit e05d3cb770
2 changed files with 16 additions and 0 deletions

View File

@ -2729,6 +2729,9 @@ unsigned ASTContext::getIntegerRank(Type *T) {
/// \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();

View File

@ -21,3 +21,16 @@ struct X0 {
};
X0<int> x0i;
namespace rdar8020920 {
template<typename T>
struct X {
enum { e0 = 32 };
unsigned long long bitfield : e0;
void f(int j) {
bitfield + j;
}
};
}