-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] fails to compile print("{}", 5s) when using libstdc++ #139067
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
Comments
Reduced example (Godbolt link): template <class R>
constexpr auto kind =
primary_template_not_defined(
kind<R> // How can this hack be valid!
);
template <class T, decltype(sizeof(0)) N>
constexpr int kind<T[N]> = 0; This was accepted by old versions of Clang, but not the trunk... |
@llvm/issue-subscribers-clang-frontend Author: Jan Piotrowicz (Taw3e8)
This [fails to compile](https://godbolt.org/z/EWrMKdd3o) without adding libc++:
#include <chrono>
#include <print>
int main() {
using namespace std::chrono_literals;
std::print("{}", 5s);
} |
Looks like this example fails in GCC as well if you instantiate |
Hmm, the primary template is assumed to be never valid, which is required for Although libstdc++'s technique looks too tricky for me... |
@jwakely fyi |
Yes, this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120190 |
Should we revert #134522 until libstdc++ is fixed? This seems rather disruptive at the moment @zwuis @AaronBallman @erichkeane |
I have no idea. It depends on you. |
I think that's a sufficiently new change to be worth reverting until we can find a way to work around the issue (even if it's a compatibility hack that only works in system headers). |
Its a little more than a month old and fixes some pretty annoying bugs. I'd like for us to not revert this if possible. Is @zwuis around? I would really like it if we could just put some sort of compatibility hack in place instead. |
IIUC it's sufficient to just give up early diagnostics for primary templates at this moment. I want a partial revert like that in #139490. |
This fails to compile without adding libc++:
The text was updated successfully, but these errors were encountered: