http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48948
--- Comment #5 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-05-10 17:07:30 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. > Consider also this, which I think demonstrates that position: struct A { struct B; void f(B) { } struct B { }; }; I think this is ill-formed by the spec, because "B" is incomplete in f's parameter and f is defined at that point. And this is not one of the contexts that B is allowed to be incomplete by 8.3.5p9. However, clang, gcc and comeau online all accept this. Apparently, they consider "f" only declared and not defined. I would be glad if someone points me to the rule that says that "f" is only considered defined at the closing "}" of A though.