Index: clang/lib/Sema/SemaOverload.cpp =================================================================== --- clang/lib/Sema/SemaOverload.cpp +++ clang/lib/Sema/SemaOverload.cpp @@ -2158,6 +2158,7 @@ if (FieldDecl *MemberDecl = From->getSourceBitField()) { llvm::APSInt BitWidth; if (FromType->isIntegralType(Context) && + !MemberDecl->getBitWidth()->isValueDependent() && MemberDecl->getBitWidth()->isIntegerConstantExpr(BitWidth, Context)) { llvm::APSInt ToSize(BitWidth.getBitWidth(), BitWidth.isUnsigned()); ToSize = Context.getTypeSize(ToType); Index: clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp =================================================================== --- /dev/null +++ clang/test/SemaTemplate/value-dependent-bitfield-cond.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// expected-no-diagnostics + +template +class a { + int c : b; + void f() { + if (c) + ; + } +}; +