C++11 static_assert and template instantiation

后端 未结 5 1088
执念已碎
执念已碎 2020-11-29 03:41

In C++11, should the operation of static_assert within a template depend on whether that template has been instantiated or not? For example, with the following code

5条回答
  •  天命终不由人
    2020-11-29 04:19

    I believe that the compiler is well within it's rights to expand any static assertions that are not dependent on template parameters without needing an instantiation- but I don't believe this is required. Remember also that different draft Standards may have different rules about when this may occur.

提交回复
热议问题