Is it possible to call templated user-defined conversion operator with explicit template arguments?

前端 未结 2 377
死守一世寂寞
死守一世寂寞 2021-01-22 01:21

Lets consider the following code (compiles successfully with clang++ 7.0.0, compiler arguments are -std=c++17 -Wall -Wextra -Werror -pedantic-errors):

2条回答
  •  生来不讨喜
    2021-01-22 01:49

    [temp.names](Names of template specializations)/1:

    A template specialization can be referred to by a template-id:

    simple-template-id:
        template-name < template-argument-listₒₚₜ >
    
    template-id:
        simple-template-id
        operator-function-id < template-argument-listₒₚₜ >
        literal-operator-id < template-argument-listₒₚₜ >
    
    template-name:
        identifier
    

    As you can see, there is no conversion-function-id

    conversion-function-id:
        operator conversion-type-id
    

    mentioned in the template-id grammar.

提交回复
热议问题