OSDN Git Service

[clang] Fix the incorrect dependence bits for DependentExtIntType.
authorHaojian Wu <hokein.wu@gmail.com>
Mon, 6 Jul 2020 14:29:16 +0000 (16:29 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Mon, 6 Jul 2020 14:42:56 +0000 (16:42 +0200)
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

clang/lib/AST/Type.cpp
clang/test/Sema/invalid-bitwidth-expr.mm

index 05962f3..10a6a26 100644 (file)
@@ -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 {
index a38ebbb..41ca949 100644 (file)
@@ -32,3 +32,8 @@ struct Z {
   int X : func<int>(); // 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);