https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Paolo Carlini paolo.carlini at oracle dot com changed:
What|Removed |Added
CC||lundberj
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #17 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-02-09
11:35:27 UTC ---
Clang++ 3.0 warns with -Wuninitialized
/tmp/webcompile/_15338_0.cc:7:5: warning: variable 'a' is uninitialized when
used within its own initialization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #18 from Lisp2D lisp2d at lisp2d dot net 2012-02-09 16:59:19 UTC
---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483#c2
shows that function calling of object before constructor is bad idea and must
be strongly forbidden.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #19 from Jonathan Wakely redi at gcc dot gnu.org 2012-02-09
17:04:06 UTC ---
Everyone knows it's a bad idea, and everyone agrees there should be a warning.
Stop going on about it.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #20 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-02-09
21:37:38 UTC ---
(In reply to comment #18)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483#c2
shows that function calling of object before constructor is bad idea
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #8 from Dmitry Gorbachev d.g.gorbachev at gmail dot com
2011-04-07 06:20:24 UTC ---
There is a call to a non-static member function of the object before
initialization by a constructor. That's undefined behavior. Not a compiler bug.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Jonathan Wakely redi at gcc dot gnu.org changed:
What|Removed |Added
Keywords||diagnostic
---
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
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #11 from Jonathan Wakely redi at gcc dot gnu.org 2011-04-07
13:26:16 UTC ---
(In reply to comment #10)
The answer of question gives the C++ standard. Show me this document.
3.3.1 Point of declaration [basic.scope.decl]
1 The point
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #12 from Jonathan Wakely redi at gcc dot gnu.org 2011-04-07
13:29:43 UTC ---
For the example in comment 2 G++, EDG and Clang++ all accept it without
warning.
MSVC rejects it, but is wrong to do so.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #13 from Jonathan Wakely redi at gcc dot gnu.org 2011-04-07
13:38:11 UTC ---
(In reply to comment #10)
(In reply to comment #9)
No, the variable is in scope after its identifier, so it can be used in the
initializer expression,
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #14 from Jonathan Wakely redi at gcc dot gnu.org 2011-04-07
13:39:45 UTC ---
(In reply to comment #13)
(In reply to comment #10)
(In reply to comment #9)
No, the variable is in scope after its identifier, so it can be used in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #15 from Lisp2D lisp2d at lisp2d dot net 2011-04-07 13:58:38 UTC
---
(In reply to comment #12)
For the example in comment 2 G++, EDG and Clang++ all accept it without
warning.
MSVC rejects it, but is wrong to do so.
The answer is
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Jonathan Wakely redi at gcc dot gnu.org changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #1 from Dmitry Gorbachev d.g.gorbachev at gmail dot com
2011-04-06 19:20:02 UTC ---
No warnings and deep stillness.
$ g++ -O -Wuninitialized pr48483.cc
pr48483.cc: In function 'int main()':
pr48483.cc:13:30: warning: 'a.A::b' is
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #2 from Lisp2D lisp2d at lisp2d dot net 2011-04-06 21:15:42 UTC
---
Try the next example, more close to my code:
#includeiostream
classA{
public:
inta;
A(intx):a(x){}
intTheInt(){returna;}
};
void
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Dmitry Gorbachev d.g.gorbachev at gmail dot com changed:
What|Removed |Added
CC|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
Dmitry Gorbachev d.g.gorbachev at gmail dot com changed:
What|Removed |Added
CC||manu at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #5 from Jonathan Wakely redi at gcc dot gnu.org 2011-04-06
23:50:38 UTC ---
and PR 18016 but I don't think my patch will catch this
there's a limit to how much silliness the compiler can catch, at some point you
have to just not
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #6 from Dmitry Gorbachev d.g.gorbachev at gmail dot com
2011-04-07 01:38:53 UTC ---
there's a limit to how much silliness the compiler can catch,
at some point you have to just not write silly code ;)
Yes, these reduced fragments
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483
--- Comment #7 from Lisp2D lisp2d at lisp2d dot net 2011-04-07 04:33:52 UTC
---
The example
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48483#c2
shows a compiler bug.
TYPE VARIABLE [ARGUMENT-TO-CONSTRUCT]
The compiler must doing like this:
1.
21 matches
Mail list logo