Consider a small standalone use case wherein I want to determine if a type is a complete or incomplete using
#include <type_traits>
namespace {
struct foo {
template<class T, std::size_t = sizeof(T)>
std::false_type operator()(T&);
std::true_type operator()(...);
};
struct FooIncomplete;
}
int main() {
std::result_of<foo(FooIncomplete&)>::type();
return 0;
}
This compiles fine with gcc 4.9.3
with --std=c++11
flag. However, with gcc 6.1
and --std=c++11
it produces a compilation error as
main.cpp: In function 'int main()':
main.cpp:17:5: error: 'type' is not a member of 'std::result_of<{anonymous}::foo({anonymous}::FooIncomplete&)>'
std::result_of<foo(FooIncomplete&)>::type();
What am I missing here ? What could be a possible work around ?
Aucun commentaire:
Enregistrer un commentaire