Reputation:
I'm just playing around a little bit with decltype and noticed the intellisense in VS 2012 is giving me a error. This is the first time I have encountered this and the code still compiled.
#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;
}
This is not a major problem nor interesting for most people but I was just wondering if anyone knows the reason behind the error?
Upvotes: 1
Views: 2045
Reputation: 385144
I was just wondering if anyone knows the reason behind the error
It's just a parsing bug. Nothing more, nothing less.
Upvotes: 1