This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/65106] C99 intialization of struct with const member through a non-const pointer
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 18 Feb 2015 14:27:30 +0000
- Subject: [Bug c/65106] C99 intialization of struct with const member through a non-const pointer
- Auto-submitted: auto-generated
- References: <bug-65106-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65106
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
See the definition of "modifiable lvalue" (6.3.2.1#1): "... if it is a
structure or union, does not have any member (including, recursively, any
member or element of all contained aggregates or unions) with a
const-qualified type". (Together with 6.5.16#2 "An assignment operator
shall have a modifiable lvalue as its left operand.".)
(It is however valid to pass arguments and return values of such types,
notwithstanding references to assignment in such contexts; see DR#427.)