Open llvmbot opened 5 years ago
mentioned in issue llvm/llvm-bugzilla-archive#41829
I'm going to raise this with the C++ committee; I think this is a defect in P0127R2.
Has this issue been raised with the C++ committee?
Thank you.
Bug llvm/llvm-bugzilla-archive#41829 has been marked as a duplicate of this bug.
A thread in the C++ std-discussion has just been started
std-discussions is pretty broken right now; it randomly rejects a significant amount of mail as "spam" :(
The problem is that in C++17 onwards, the type of a non-type template parameter is deduced from the type of the argument. In C++14 and before, deducing the parameters of X
from <bool&, v>
deduces T=bool&
from the first argument and v=v
from the second. But in C++17 onwards, we also deduce T=bool
from the second argument, which results in that no longer being a valid specialization, because we "don't know" what type T
should be.
I'm going to raise this with the C++ committee; I think this is a defect in P0127R2.
Extended Description
Consider the following MWE:
As shown in https://www.godbolt.org/z/HqqLWu, the MWE is accepted by GCC when using C++14 (the compilation switches
-std=c++14 -pedantic-errors
) and when using C++17 (the compilation switches-std=c++17 -pedantic-errors
).Clang also accepts the MWE when using C++14 but not when using C++17.
A thread in the C++ std-discussion has just been started on this matter (see https://groups.google.com/a/isocpp.org/d/msg/std-discussion/etn0e3qhz28/Nmpmz7NwBAAJ), but no one has replied yet. Nevertheless, I think this is a bug considering that Clang accepts the MWE in C++14, and I think, there is no change in C++17 that justifies Clang behavior in rejecting the MWE in C++17.
This bug may also be related to this bug: llvm/llvm-project#38721