googlewalt wrote:
We're seeing a crash on Windows due to this change. Can you please take a look?
```
> cat test.ii
struct t1 {
virtual __declspec(nothrow) long __stdcall d();
};
struct t2 : t1 {
long __stdcall d();
};
struct t3 {
t2* operator->();
};
t3 a;
void h() {
if (auto g = a->d())
;
}
# Running clang with assertions enabled.
> clang -std=c++20 --target=i686-pc-windows-msvc -O0 -c test.ii -o /dev/null
test.ii:5:18: warning: exception specification of overriding function is more
lax than base version [-Wmicrosoft-exception-spec]
5 | long __stdcall d();
| ^
test.ii:2:46: note: overridden virtual function is here
2 | virtual __declspec(nothrow) long __stdcall d();
|
clang: <path>/llvm-project/clang/lib/AST/ExprConstant.cpp:21270: bool
clang::Expr::EvaluateAsInt(EvalResult &, const ASTContext &, SideEffectsKind,
bool) const: Assertion `!isValueDependent() && "Expression evaluator can't be
called on a dependent expression."' failed.
...
```
The original reduction I had produced a different assert, but the code
wasn't semantically valid. I suspect the underlying cause for the
crash is the same though. I'm providing it here for completeness:
```
> cat test.ii
struct c {
virtual __declspec(nothrow) long __stdcall d();
};
struct B : c {
long __stdcall d();
};
struct f {
B* operator->();
};
template <typename>
using b = f;
struct e {
e();
operator bool();
};
b<B> a;
void h() {
if (e g = a->d())
;
}
# Running clang with assertions enabled.
> clang -std=c++20 --target=i686-pc-windows-msvc -O0 -c test.ii -o /dev/null
test.ii:5:18: warning: exception specification of overriding function is more
lax than base version [-Wmicrosoft-exception-spec]
5 | long __stdcall d();
| ^
test.ii:2:46: note: overridden virtual function is here
2 | virtual __declspec(nothrow) long __stdcall d();
| ^
clang: <path>/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp:2178: void
clang::CodeGen::CodeGenFunction::EmitAggExpr(const Expr *, AggValueSlot):
Assertion `E && hasAggregateEvaluationKind(E->getType()) && "Invalid aggregate
expression to emit"' failed.
...
```
https://github.com/llvm/llvm-project/pull/184048
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits