https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113060
Jiang An <de34 at live dot cn> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |de34 at live dot cn
--- Comment #4 from Jiang An <de34 at live dot cn> ---
Hi, I found that we can support std::variant<float>(IC{}) with C++17 core
language rules (as modified by P2280R4), and thus P3146 should be updated.
Proof-of-concept example (https://gcc.godbolt.org/z/174sx397f):
```
#include <type_traits>
#include <utility>
template<class Ti>
struct array_element_initialization_tester {
Ti elems[1];
};
template<class Ti, class Tp>
auto test_array_element_initializable(Tp&& t)
-> decltype((void)
array_element_initialization_tester<Ti>{{std::forward<Tp>(t)}});
template<class Ti, class Tp, class = void>
constexpr bool is_array_element_initializable_from = false;
template<class Ti, class Tp>
constexpr bool is_array_element_initializable_from<Ti, Tp,
decltype(::test_array_element_initializable<Ti>(std::declval<Tp>()))> =
true;
template <typename T,
std::enable_if_t<is_array_element_initializable_from<float, T>, int> = 0>
void FUN(float);
int main() {
using IC = std::integral_constant<int, 42>;
FUN<IC>(IC{});
IC ic;
FUN<IC&>(ic);
}
```
Note that this example adds a mediate function template
(test_array_element_initializable) to "reduce" the non-constexpr-ness of
std::declval.