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 | ceafbdeb93ecf323cca74e660bf54504c86f3b71 (patch) | |
tree | cfedb2dff59e9a49d0d005647d0e28c479596a09 | |
parent | d342bf7fdb5a16fe73e46a8c995ad89cf79a7bad (diff) |
A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104545 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTContext.cpp | 3 | ||||
-rw-r--r-- | test/SemaTemplate/enum-argument.cpp | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index d6e094e5b4..aa98910f0f 100644 --- a/lib/AST/ASTContext.cpp +++ b/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/test/SemaTemplate/enum-argument.cpp b/test/SemaTemplate/enum-argument.cpp index de89487bd5..7d23757067 100644 --- a/test/SemaTemplate/enum-argument.cpp +++ b/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; + } + }; +} |