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
clang 16 -> 17 regression: "deduced return type cannot be used before it is defined" #64029
Comments
@llvm/issue-subscribers-clang-frontend |
This is broken by 0fd9c37 It compiles with This is not a regression because your code has undefined behaviour (you modify the namespace my_namespace {
#ifdef __cpp_lib_forward_like
using std::forward_like;
#else
// your definition for forward_like
#endif
} Though I do agree the given warning is confusing, and might be a sign that the implementation of the builtin wouldn't work with a conforming library implementation of |
Thanks for the reply, and yes it's definitely UB but indeed the error message threw me off (I would expect it to complain about a redefinition). But then again, why isn't Edit. |
Reopening for reconsideration because https://github.com/microsoft/STL/blob/f98b286a17e7c72e3fa10297868b877f9cdc0fa8/stl/inc/utility#L930-L949 is "the implementation" =) We can workaround the issue, but we'd rather not muss our nicely clean implementation. Is there any chance you folks will address this regression? |
@CaseyCarter Could you do something like libc++ ?
The issue only affects implements who use type deduction in forward-like @zygoloid did that work so maybe he would have a better idea! |
As part of treating So, we could change Clang to accept this implementation of |
I was hoping for "even-more-builtin" as a best case, but I admit the marginal benefit over the current optimization would be small. In any case, I've found a compromise that I think MSVC and Clang are equally happy with; let's close this issue again. |
See minimal reproducer here (godbolt).
It works fine in Clang 16.0.0 (and older, tested back to 11.0), but fails in 17 (trunk).
The text was updated successfully, but these errors were encountered: