Vote count: 0
Consider this code:
#include <type_traits>
template < int > struct II { };
template < const int& > struct RR { };
template < template <auto> typename Class, typename Type > struct Check : std::false_type { };
template < template <auto> typename Class, auto NonTypes > struct Check<Class,Class<NonTypes>> : std::true_type { };
constexpr int TEN = 10;
constexpr const int& REF = TEN;
static_assert(Check<II,II<TEN>>::value); // passes
static_assert(Check<RR,RR<REF>>::value); // FAILS!?
The last static assertion fails and it also fails when replacing auto by const int& in Check templates.
I am using gcc-7.0.1 and here is the live example. The question is if this is a compiler bug or I am doing something wrong?
asked 16 secs ago
Bug in gcc with const& template parameters?
Aucun commentaire:
Enregistrer un commentaire