https://bugs.llvm.org/show_bug.cgi?id=52231
Bug ID: 52231
Summary: discarded statement and immediate invocation contexts
are not mutually exclusive
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: C++2b
Assignee: unassignedclangb...@nondot.org
Reporter: aa...@aaronballman.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Clang currently rejects this valid C++2b program:
```
consteval int *make() { return new int; }
auto f() {
if constexpr (false) {
if consteval {
// Immediate function context, so call to `make()` is valid.
// Discarded statement context, so `return 0;` is valid too.
delete make();
return 0;
}
}
// FIXME: this error should not happen.
return 0.0; // expected-error {{'auto' in return type deduced as 'double'
here but deduced as 'int' in earlier return statement}}
}
```
https://godbolt.org/z/Y81nf63f7
This seems to happen because we treat a discarded statement evaluation context
as being mutually exclusive with an immediate invocation, but as this code
shows, they are not mutually exclusive in practice.
See https://reviews.llvm.org/D112089 for details.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs