diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -347,15 +347,7 @@ DependentExtIntType::DependentExtIntType(const ASTContext &Context, bool IsUnsigned, Expr *NumBitsExpr) : Type(DependentExtInt, QualType{}, - ((NumBitsExpr->isValueDependent() || NumBitsExpr->isTypeDependent()) - ? TypeDependence::Dependent - : TypeDependence::None) | - (NumBitsExpr->isInstantiationDependent() - ? TypeDependence::Instantiation - : TypeDependence::None) | - (NumBitsExpr->containsUnexpandedParameterPack() - ? TypeDependence::VariablyModified - : TypeDependence::None)), + toTypeDependence(NumBitsExpr->getDependence())), Context(Context), ExprAndUnsigned(NumBitsExpr, IsUnsigned) {} bool DependentExtIntType::isUnsigned() const { diff --git a/clang/test/Sema/invalid-bitwidth-expr.mm b/clang/test/Sema/invalid-bitwidth-expr.mm --- a/clang/test/Sema/invalid-bitwidth-expr.mm +++ b/clang/test/Sema/invalid-bitwidth-expr.mm @@ -32,3 +32,8 @@ int X : func(); // expected-note {{in instantiation of function template}} }; constexpr int ssss = sizeof(Z); + +struct Z2 { + int X : sizeof(_ExtInt(invalid())); // expected-error {{use of undeclared identifier}} +}; +constexpr int sssss = sizeof(Z2);