I have the following code:
#include "type_traits"
template<typename T_>
struct thing{
template<typename me_type>
struct inner {
static T_& impl_0 (void* me ) { return static_cast<me_type*>(me )->operator*(); }
static auto getThing()
{
return std::integral_constant<T_& (*)(void*),&impl_0>();
}
};
};
It declares a static function inside a templated class that is inside another templated class.
Then it declares an auto function, which returns an pointer to that function, but first it puts it into a std::integral_constant
When I give this to gcc version 7.3 (godbolt) with the compiler flags -std=c++14
it complains:
<source>: In static member function 'static auto thing<T_>::inner<me_type>::getThing()':
<source>:11:69: error: template argument 2 is invalid
return std::integral_constant<T_& (*)(void*),&impl_0>();
But when I give it to clang version 6.0.0 it compiles just fine (godbolt).
Should it compile or not?