diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-05-24 20:13:53 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-05-24 20:13:53 +0000 |
| commit | e05d3cb770d1b710c15bfdb89a417d48e3226741 (patch) | |
| tree | 9064e705cf2c0d8020ba9565f4b936138c04c3ff | |
| parent | 722bff2c7dd668fbbaddf7891924474efcbf16e9 (diff) | |
| download | bcm5719-llvm-e05d3cb770d1b710c15bfdb89a417d48e3226741.tar.gz bcm5719-llvm-e05d3cb770d1b710c15bfdb89a417d48e3226741.zip | |
A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.
llvm-svn: 104545
| -rw-r--r-- | clang/lib/AST/ASTContext.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/enum-argument.cpp | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index d6e094e5b4a..aa98910f0ff 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -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(); diff --git a/clang/test/SemaTemplate/enum-argument.cpp b/clang/test/SemaTemplate/enum-argument.cpp index de89487bd58..7d237570678 100644 --- a/clang/test/SemaTemplate/enum-argument.cpp +++ b/clang/test/SemaTemplate/enum-argument.cpp @@ -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; + } + }; +} |

