Does casting to a pointer to a template instantiate that template?

后端 未结 2 1716
谎友^
谎友^ 2020-12-29 22:07

static_cast*>(0) - does this instantiate the_template with type int?

The reason for asking is th

2条回答
  •  太阳男子
    2020-12-29 23:09

    It is not the cast that instantiates the class template specialization, but the function call, because the argument triggers ADL . The instantiation is done because the completeness of it may affect the semantics of the program.

    That clang does not follow the spec here is known and a PR was sent by me some time ago. See http://llvm.org/bugs/show_bug.cgi?id=9440

提交回复
热议问题