This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/58317] Calling a method while preparing to call the constructor should be illegal


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]