VS 2012 intellisense-函数可能未初始化

VS 2012 intellisense - function may not be initialized

本文关键字:初始化 函数 2012 intellisense- VS      更新时间:2023-10-16

我只是在玩decltype,注意到VS 2012中的intellisense给了我一个错误。这是我第一次遇到这种情况,代码仍在编译中。

#include <iostream>
int func(int param)
{
    std::cout << "IM BEING CALLED: " << param << std::endl;
    return 0;
}
int main()
{
    auto& y = func;
    auto z = func;
    decltype((func))& x = func;
    decltype((func)) k = func; // function 'k' may not be initialized but compiles

    func(9);
    x(10);
    y(11);
    z(12);
    k(13);
    std::cout << std::endl;
    std::cout << "Address of func: " << func << std::endl;
    std::cout << "Address of x: " << x << std::endl;
    std::cout << "Address of y: " << y << std::endl;
    std::cout << "Address of z: " << z << std::endl; 
    std::cout << "Address of k: " << k << std::endl; 
    std::cin.get();
    return 0;
}

这对大多数人来说既不是一个大问题,也不是一个有趣的问题,但我只是想知道是否有人知道错误背后的原因?

我只是想知道是否有人知道错误背后的原因

这只是一个解析错误。没有更多,没有更少。