C++ koenig lookup problem

Why does not the following code compile?

 #include <iostream>
// Does Koenig lookup work only for derived datatypes?
namespace FBB
  float y;
  class T
  T a;
  void classTest(T arg)
    std::cout<<"Inside class test"<<std::endl;

  void fun(float x)
    std::cout << "fun called for " << x << std::endl;

int main()
  // this line does not compile
  //  fun(FBB::y);
  FBB::fun(FBB::y); // works
  // for fun()

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: