Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

decltype not recognised as type specifier for base-class

$
0
0

The following code compiles fine under clang and gcc but fails for icc (v14.0.2):

namespace traits_tests {
  template<typename> struct sfinae_true : true_type {};

  template<typename T> static auto value_type(int)   -> sfinae_true<typename T::value_type>;
  template<typename T> static auto value_type(void*) -> false_type;
}
template<typename C>
struct has_value_type
  : decltype(traits_tests::value_type<C>(0)) {};

with the error message

inc/traits.h(258): error: expected an identifier

      : decltype(traits_tests::value_type<C>(0)) {};

        ^

.

 

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>