Incorrect overload resolution for 2-argument functions

前端 未结 3 382
粉色の甜心
粉色の甜心 2021-01-12 02:30

Let\'s take the following example program:

#include 

namespace half_float
{
    template struct half_expr {};

    struct hal         


        
3条回答
  •  有刺的猬
    2021-01-12 03:11

    I just tried your code, and I figured out what was wrong with it.

    Since you haven't implemented half::sin and half::atan2, the linker will throw an error anyway. So if you implement the methods half::sin and half::atan2, that should solve it (I implemented them by letting them return an empty half, which is, of course, meaningless).

    After I took that step (providing a (meaningless) implementation of the two required methods), the error messages almost magically disappeared.

    Maybe this isn't the solution to your problem, as I'm using GCC, and not VS.


    EDIT: I just tried the sample I used with G++ with visual studio, which gave me a peculier error message. Provided the strangeness of the error, and the code working with GCC, I must conclude that this is a bug in VC2012.

提交回复
热议问题