[Bug libstdc++/92224] Set: Can't be created a set with const template parameter

2019-10-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224

--- Comment #4 from Jonathan Wakely  ---
It's undefined, so the implementation is not required to give an error. To
quote the standard:

Undefined behavior may be expected when this document omits any explicit
definition of behavior or when a program uses an erroneous construct or
erroneous data. Permissible undefined behavior ranges from ignoring the
situation completely with unpredictable results, to behaving during translation
or program execution in a documented manner characteristic of the environment
(with or without the issuance of a diagnostic message), to terminating a
translation or execution (with the issuance of a diagnostic message).

[Bug libstdc++/92224] Set: Can't be created a set with const template parameter

2019-10-26 Thread mariogalindoq at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224

--- Comment #3 from Mario Galindo  ---
Thank you sir. As clang is allowing this type of construction, I believe now
that the "bug" is in clang, not gcc. Regards.

Dr. Ing. Mario Galindo Q.
Cel: 591-72062746 & 591-72010422

On 25 Oct 2019 06:20, "redi at gcc dot gnu.org" 
wrote:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224

--- Comment #2 from Jonathan Wakely  ---
Also, set keys are *not* const, otherwise you wouldn't be able to assign one
set to another set without reallocating every element.

std::set::iterator only gives you const *access* to the elements, but the
elements themselves are not actually const.

--
You are receiving this mail because:
You are on the CC list for the bug.
You reported the bug.

[Bug libstdc++/92224] Set: Can't be created a set with const template parameter

2019-10-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224

--- Comment #2 from Jonathan Wakely  ---
Also, set keys are *not* const, otherwise you wouldn't be able to assign one
set to another set without reallocating every element.

std::set::iterator only gives you const *access* to the elements, but the
elements themselves are not actually const.

[Bug libstdc++/92224] Set: Can't be created a set with const template parameter

2019-10-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92224

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Jonathan Wakely  ---
The standard says that the template argument for an allocator must be a
non-const, non-volatile object type, so trying to instantiate
std::allocator is undefined, and libstdc++ is allowed to reject it.