This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48483] Construct from yourself w/o warning
- From: "lisp2d at lisp2d dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 7 Apr 2011 13:19:28 +0000
- Subject: [Bug c++/48483] Construct from yourself w/o warning
- Auto-submitted: auto-generated
- References: <bug-48483-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #10 from Lisp2D <lisp2d at lisp2d dot net> 2011-04-07 13:19:16 UTC ---
(In reply to comment #9)
> No, the variable is in scope after its identifier, so it can be used in the
> initializer expression, e.g.
>
> int i = sizeof(i); // ok
> int i = i+1; // not ok
My opinion is that C habit rules here.
In C
int i=i+1; -> int i; i=i+1;
without constructors, objects e.t.c.
This example will bring just a warning.
In C++
Class i(i.Method()); eval i.Method() -> construct with Class::Class(result)
another order of calculation. (see comment 2) Must be an error.
The answer of question gives the C++ standard. Show me this document.