[Bug c++/58317] Calling a method while preparing to call the constructor should be illegal
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 7 08:57:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58317
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Oleg Smolsky from comment #2)
> Hey Jonathan, here is a simpler and more natural way to rewrite your example:
>
> struct A {
> static int f() { return 0; }
> A(int) { }
> };
>
> int main() {
> A a(A::f()); // it is static!
> }
Yes, I know, that's not the point. The standard doesn't disallow everything
that can be written another way. The point is that the original code is
syntactically legal.
> So, do you happen do have a reference to the Standard? Or is it one of the
> things that are not mentioned explicitly?
3.3.2 [basic.scope.pdecl] paragraph 1.
I already said GCC fails to warn, but it should not reject the code.
More information about the Gcc-bugs
mailing list