[ create a new paste ] login | about

Link: http://codepad.org/wu2LXEuB    [ raw code | output | fork ]

C++, pasted on Feb 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
struct D
{
  std::string foo;
  operator std::string&() {return foo;}
  operator const std::string&() const {return foo;}
};

int main(int argv, char** argc)
{
  D myFoo;
  myFoo.foo = "foo";
  return myFoo.length();
}


Output:
1
2
3
In function 'int main(int, char**)':
Line 12: error: 'struct D' has no member named 'length'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: