Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

Enum members are not visible to template specialization

$
0
0

I have a code example which originates from llvm source code but modified to clearly provide the issue.

It compiles fine with clang but fails with icl. Here's the code:

#include <type_traits>

template <typename E, typename Enable = void>
struct is_valid : std::false_type {};

template <typename E>
struct is_valid<E, typename std::enable_if<sizeof(E::EnumMember) >= 0>::type> : std::true_type {};

template <typename E, typename = typename std::enable_if<is_valid<E>::value>::type>
void function(const E &myEnum) {
  return;
}

enum MyEnum {
  EnumMember = 0
};

int main() {
  MyEnum myEnum;
  function(myEnum);
}

 

Intel Compiler XE 2018, Windows


Viewing all articles
Browse latest Browse all 1175

Trending Articles



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