-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Regression] clang 18 compiler crash involving auto return type, auto-conversion and source_location #92680
Comments
@llvm/issue-subscribers-clang-codegen Author: Alexander Karatarakis (alexkaratarakis)
### Min repro
```C++
#include <memory>
#include <source_location>
struct IntConstuctible
}; static auto construct_at_address_of(IntConstuctible& p, int a) int main()
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
|
Looks like a regression from clang-17: https://godbolt.org/z/rMfh4n69j Unreachable: undeduced type in IR-generation CC @cor3ntin |
Confirmed on trunk. namespace std {
struct source_location {
struct __impl {
const char *_M_file_name;
const char *_M_function_name;
int _M_line;
int _M_column;
};
using __builtin_ret_type = decltype(__builtin_source_location());
static source_location current(__builtin_ret_type = __builtin_source_location());
};
} // namespace std
struct IntConstuctible {
IntConstuctible(std::source_location = std::source_location::current());
};
template <typename>
auto construct_at(IntConstuctible) -> decltype(IntConstuctible()) {
return {};
}
int main() {
construct_at<IntConstuctible>({});
} Clang 19.0 crash:
|
@llvm/issue-subscribers-c-20 Author: Alexander Karatarakis (alexkaratarakis)
### Min repro
```C++
#include <memory>
#include <source_location>
struct IntConstuctible
}; static auto construct_at_address_of(IntConstuctible& p, int a) int main()
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
|
In order for their dependency to be computed correctly, SourceLocExpr should refer to the context in which they are used. Fixes llvm#92680
In order for their dependency to be computed correctly, SourceLocExpr should refer to the context in which they are used. Fixes #92680
Min repro
Godbolt Link
https://godbolt.org/z/a4TxoE9jv
Additional notes
construct_at_address_of()
explicitly does not crash.return
fromconstruct_at_address_of()
does not crash.source_location
parameter in the auto-converted type does not crash.std::source_location::current()
instead of relying on the default parameter does not crash.Stack dump
The text was updated successfully, but these errors were encountered: