You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
-- 8< ---------------------
template<typename T, T v>
struct X {
};
template<bool &v>
struct X<bool &, v> {
};
-- 8< ---------------------
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: #38721
The text was updated successfully, but these errors were encountered: