https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #9 from Martin Sebor ---
The purpose of friendship is to grant access to class members that would
otherwise be inaccessible. The purpose of constructors is to establish class
invariants, and it is the responsibility of member functio
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #8 from Mathias Stearn ---
> If the constructor had other side-effects (e.g., count
> the number of objects of the class) bypassing it could
> violate the invariant.
I thought one of the points of friendship was to allow friends t
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
Martin Sebor changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
Richard Biener changed:
What|Removed |Added
Status|WAITING |NEW
--- Comment #6 from Richard Biener
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #5 from Jonathan Wakely ---
IMHO classes and their friends should not have any special exemptions, because
undefined behaviour is still undefined behaviour, it doesn't matter who does
it. But in this case I don't think there is any UB
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #4 from Jonathan Wakely ---
The Position type is trivially-copyable, so IMHO shouldn't warn about uses of
memset/memcpy, but I'm not sure what the conditions for the warning are.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #3 from Richard Biener ---
Note for the example if you use -O3 the loop gets turned into memset() and the
code generated is the same besides the memset being conditional
on if (_buckets != 0)
For the diagnostic, isn't class Position
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
--- Comment #2 from Mathias Stearn ---
Here is a boiled down example of some of our code that trips this warning:
https://godbolt.org/g/ChLrch. It also shows why we do this, since the codegen
is *substantially* better for init_table_memset than i
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85707
Martin Sebor changed:
What|Removed |Added
Keywords||diagnostic
Status|UNCONFIRMED