Index: clang/lib/Sema/SemaChecking.cpp =================================================================== --- clang/lib/Sema/SemaChecking.cpp +++ clang/lib/Sema/SemaChecking.cpp @@ -10161,7 +10161,13 @@ return IntRange(EIT->getNumBits(), EIT->isUnsigned()); const BuiltinType *BT = cast(T); - assert(BT->isInteger()); + if (!BT->isInteger()) { + // This can happen in a conditional expression with a throw statement + // C++11 [expr.cond]p2 + // If either the second or the third operand has type (cv) void, ... + assert(BT->isVoidType()); + IntRange(1, true /*NonNegative*/); + } return IntRange(C.getIntWidth(QualType(T, 0)), BT->isUnsignedInteger()); } Index: clang/test/SemaCXX/conditional-expr.cpp =================================================================== --- clang/test/SemaCXX/conditional-expr.cpp +++ clang/test/SemaCXX/conditional-expr.cpp @@ -409,3 +409,17 @@ D d = b ? D{B()} : D{C()}; } } + +namespace PR46484 { +// expected-error@+4{{expected ':'}} +// expected-note@+3{{to match this '?'}} +// expected-warning@+2{{variable 'b' is uninitialized}} +// expected-error@+1 2 {{expected ';' after top level declarator}} +int a long b = a = b ? throw 0 1 + +void g() { + extern int a; + extern long b; + long c = a = b ? throw 0 : 1; +} +} // namespace PR46484