Bruno Nery <br...@thousandeyes.com> writes:

| Howdy,
>
| The following piece of code:
>
| === snip ===
| #include <iostream>
>
| struct warnme
| {
|     bool member_;
|     warnme(bool member) : member_(member_) {}
| };
>
| int main()
| {
|     warnme wm(true);
|     std::cout << wm.member_ << std::endl;
|     return 0;
| }
| === end snip ===
>
| when compiled with g++ 4.7, gives me no warnings - even with
| -Wuninitialized (clang++ 3.1 is fine, by the way). I then decided to
| report a bug, but:

g++ -Wall -Wextra -O uninit.cpp 
uninit.cpp:6:5: warning: unused parameter ‘member’ [-Wunused-parameter]
uninit.cpp: In function ‘int main()’:
uninit.cpp:12:21: warning: ‘wm.warnme::member_’ is used uninitialized in
this function [-Wuninitialized]

Some checking is only done if optimization is on.

g++ --version
g++ (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)

-- 
        Lgb

Reply via email to