https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #12 from Mike Sharov ---
(In reply to Jonathan Wakely from comment #10)
> It's simply not how C++ works.
Quite right. I already agreed with you here; we are arguing about whether it
/should/ work this way :)
> An object's lifetime i
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #11 from Jonathan Wakely ---
(In reply to Jonathan Wakely from comment #10)
> (In reply to Mike Sharov from comment #8)
> > My mental model here is actually of const correctness, not C++ specifically.
> > When I pass around a const ob
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #10 from Jonathan Wakely ---
(In reply to Mike Sharov from comment #8)
> My mental model here is actually of const correctness, not C++ specifically.
> When I pass around a const object I expect it to stay unmodified. Consider a
> fun
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #9 from Jonathan Wakely ---
That's not how C++ works.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #8 from Mike Sharov ---
(In reply to Jonathan Wakely from comment #7)
> Your mental model of C++ is simply not how the language works.
My mental model here is actually of const correctness, not C++ specifically.
When I pass around a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
Jonathan Wakely changed:
What|Removed |Added
Status|WAITING |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #6 from Mike Sharov ---
(In reply to Jonathan Wakely from comment #5)
> Nope, see the C++ standard:
>
> [ Note: A pointer to a const type can be the operand of a
> delete-expression;
Ok, I guess; you have to follow the standard, a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #5 from Jonathan Wakely ---
Nope, see the C++ standard:
[ Note: A pointer to a const type can be the operand of a delete-expression;
it is not necessary to cast away the constness (8.5.1.11) of the pointer
expression before it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #4 from Mike Sharov ---
(In reply to Jonathan Wakely from comment #3)
> Nothing stops you deallocating a const pointer.
According to http://en.cppreference.com/w/cpp/memory/new/operator_delete
The delete operator takes a void* and at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
Jonathan Wakely changed:
What|Removed |Added
Status|UNCONFIRMED |WAITING
Last reconfirmed|
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #3 from Jonathan Wakely ---
(In reply to Mike Sharov from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > (In reply to Mike Sharov from comment #0)
> > > When the pointer is const, it can not point to owned memory
> >
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #2 from Mike Sharov ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to Mike Sharov from comment #0)
> > When the pointer is const, it can not point to owned memory
> Why not?
Because a const pointer can not be freed. By
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85858
--- Comment #1 from Jonathan Wakely ---
(In reply to Mike Sharov from comment #0)
> When the pointer is const, it can not point to owned memory
Why not?
13 matches
Mail list logo