This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52145] [C++11] [DR 903] zero-valued integer constant expression should prefer conversion to pointer
- From: "jyasskin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 26 Apr 2012 19:42:19 +0000
- Subject: [Bug c++/52145] [C++11] [DR 903] zero-valued integer constant expression should prefer conversion to pointer
- Auto-submitted: auto-generated
- References: <bug-52145-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52145
Jeffrey Yasskin <jyasskin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |NEW
CC| |jyasskin at gcc dot gnu.org
--- Comment #3 from Jeffrey Yasskin <jyasskin at gcc dot gnu.org> 2012-04-26 19:42:19 UTC ---
A simpler test case is:
$ cat test.cc
const long kNullPtr = 0;
const long* ptr = kNullPtr;
$ g++-4.7pre -c test.cc -std=gnu++11
test.cc:2:19: error: invalid conversion from âlong intâ to âconst long int*â
[-fpermissive]
$ g++-4.7pre --version
g++-4.7pre (GCC) 4.7.1 20120412 (prerelease)
I'm going to unsuspend this because DR903 is "ready", and gcc-4.7's behavior
doesn't match either the proposed wording or the current definition of C++11.
The proposed wording discusses a change to C++17 rather than to C++11 (we can
tell because it adds a "C.3 C++ and ISO C++ 2011" section), so the new error
should only show up under -std=gnu++17, and be a warning in -std=gnu++11.