mardi 27 décembre 2016

VC Bug? Non-constexpr Function Template Evaluated as constexpr

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;
}

Aucun commentaire:

Enregistrer un commentaire