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

"if constexpr" and "missing return statement..." in icpc v 19

$
0
0

in icpc (ICC) 19.0.0.117 20180804, if I have a function with auto return type and a non-ambiguous "if constexpr" stanza like this:

template<typename ... ARGS> auto foo(ARGS ... args)
{
  if constexpr (sizeof...(args) == 1)
  {
    return /* variable of some type */;
  }
  else
  {
    return /* variable of another type */
  }
}

I get error  #1011: missing return statement at end of non-void function.  GCC is fine with it.  I can't figure a work-around except to fall back to SFINAE and enable_if


Viewing all articles
Browse latest Browse all 1175

Trending Articles



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