http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48948
--- Comment #6 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-05-10 17:20:31 UTC --- (In reply to comment #4) > (In reply to comment #0) > > gcc 4.7.0 20110507 (experimental) in C++0x mode rejects the following code > > at > > the line marked with #: > > > > //--- > > struct B { > > friend constexpr int f(B) { return 0; } // # > > }; > > //--- > > > > "error: invalid type for parameter 1 of constexpr function 'constexpr int > > f(B)'" > > > > This code should be accepted. > > > > I remember that Gaby (I hope I remember correctly, hehe) argued that the body > of "f" is late-parsed. Hence, the argument, until after the end of definition > of "B", "f" is only considered declared but not defined. > > I don't share that view though. That view is an implementation detail. In the > language, the function marked by "#" is defined as soon as its body has been > completely seen. If something else is intended, the specification needs to be > explicit about this. Unless I've missed the text, it is not explicit about > that. But I can live with that. Having remembered the intent as described, I see that the friend function you already showed is valid, because when the body is late parsed, and the function is then considered defined only when the enclosing class is complete, it makes sense. I wouldn't intuitively get to this result though, but I think it's an interpretation I can live with! I'm sorry for that load of nonsense in the comment boxes. I promise this is the last comment in this row of this PR! :)