[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-04-16 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Jonathan Wakely  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jonathan Wakely  ---
Eric, could you open a new PR and CC Martin please?

[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-04-16 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Martin Sebor  changed:

   What|Removed |Added

 Blocks||55004

--- Comment #6 from Martin Sebor  ---
Sure, I can look into it sometime in stage 1.  But I'm not sure these bugs are
related.  The test case in comment #0 and those in pr60760 and pr71091 are
about invalid uses of null pointers in constexpr contexts.  The test cases here
don't involve bull pointers.  Rejecting invalid casts was the subject of
pr49171 (fixed in r259629).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues

[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-04-16 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Jonathan Wakely  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||msebor at gcc dot gnu.org
 Resolution|FIXED   |---

--- Comment #5 from Jonathan Wakely  ---
Martin, do you want to take a look at these cases, which your 2238909 change
didn't handle?

char gdummy = {};
constexpr int* test_global = (int*)(void*)&gdummy; // ill-formed
static_assert(test_global);

constexpr bool test_local() {
float dummy = {};
(int*)(void*)&dummy; // ill-formed
return true;
}
static_assert(test_local(), "");

[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-04-13 Thread eric at efcs dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Eric Fiselier  changed:

   What|Removed |Added

 CC||eric at efcs dot ca

--- Comment #4 from Eric Fiselier  ---
Hi Jonathan,

Can you re-open this bug? GCC still accepts a number of conversions from void
that it shouldn't.

// g++ -std=c++2a 
float dummy = {};
static_assert((int*)(void*)&dummy);

https://godbolt.org/z/_DtmUc

[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-01-06 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Jonathan Wakely  changed:

   What|Removed |Added

Version|8.2.0   |4.9.2
   Target Milestone|--- |7.0

--- Comment #3 from Jonathan Wakely  ---
Fixed for GCC 7.1 by r238909, which fixed:

PR c++/60760 - arithmetic on null pointers should not be allowed in
constant
PR c++/71091 - constexpr reference bound to a null pointer dereference

[Bug c++/65799] Allows constexpr conversion from cv void * to other type

2019-01-06 Thread haining.cpp at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65799

Ryan R Haining  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from Ryan R Haining  ---
code is correctly failing on head:
https://wandbox.org/permlink/6vj1agxCRZaTYs7b