VC Bug? Non-constexpr Function Template Evaluated as constexpr

67 views Asked by At

Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 does not issue errors when compiling the code below. Am I missing something?


Thank you.

#include <iostream>

template < class T > constexpr T oops( T s )
{
  std::cout << s; // ignored - no code is generated
  return s;
}

int main()
{
  static_assert( oops( 1 ) == 1, "!" ); // non-constant condition not detected
  return 0;
}
0

There are 0 answers