This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR c/12446

On Fri, 3 Oct 2003, Gabriel Dos Reis wrote:

> In an assignment, the right-hand-side expression is *converted* to the
> type of the left-hand-side expression.  In this case, that means
> decaying the array, which is undefined behaviour.  It is not an issue
> of assigning values of incompatible types.

It is converted, subject to *constraints* (i.e., diagnostic required for
violation) on the types of the operands.  The listed possibilities for the
types of the operands in assignment do not include array types, so there
is a constraint violation and a diagnostic is required.  (Whether there
might *also* be undefined behavior is irrelevant, as C90 TC1 made it
explicit that constraint violations require diagnostics even if there is
undefined behavior as well.)  Much the same applies to most other
operators you might pass an array to: the types of permitted operands do
not include array types.  One exception to this is the comma operator, so
the testsuite duly contains tests for passing non-lvalue arrays to the
comma operator.

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]