From: Haojian Wu Date: Mon, 6 Jul 2020 14:29:16 +0000 (+0200) Subject: [clang] Fix the incorrect dependence bits for DependentExtIntType. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=cd9a241f165013902fc060ace88c66e402c7767a;p=android-x86%2Fexternal-llvm-project.git [clang] Fix the incorrect dependence bits for DependentExtIntType. The error-bit was missing, and the unexpandedpack bit seemed to be set incorrectly. Reviewed By: sammccall, erichkeane Differential Revision: https://reviews.llvm.org/D83114 --- diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 05962f34bbf..10a6a261013 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -347,15 +347,7 @@ ExtIntType::ExtIntType(bool IsUnsigned, unsigned NumBits) 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 index a38ebbbd675..41ca9496de4 100644 --- a/clang/test/Sema/invalid-bitwidth-expr.mm +++ b/clang/test/Sema/invalid-bitwidth-expr.mm @@ -32,3 +32,8 @@ struct Z { 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);