aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-04 13:09:01 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-04 13:09:01 +0000
commit46ff3034d14aaa92b530e96480741f3d5d458cb8 (patch)
treeb4a98b2a1e64022d0fe355828a137a71f8bd4153 /lib/Sema/SemaChecking.cpp
parentfdc13a00a0077383eabf6d994de10203568415bb (diff)
Before checking bitfield initialization, make sure that neither the
bit-field width nor the initializer value are type- or value-dependent. Fixes PR8712. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r--lib/Sema/SemaChecking.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 24ce72032c..24dcfb62a1 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -2643,6 +2643,13 @@ bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init,
if (Bitfield->getType()->isBooleanType())
return false;
+ // Ignore value- or type-dependent expressions.
+ if (Bitfield->getBitWidth()->isValueDependent() ||
+ Bitfield->getBitWidth()->isTypeDependent() ||
+ Init->isValueDependent() ||
+ Init->isTypeDependent())
+ return false;
+
Expr *OriginalInit = Init->IgnoreParenImpCasts();
llvm::APSInt Width(32);