File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change
1
+ /* RUN: %clang_cc1 -verify -pedantic -std=c99 %s
2
+ RUN: %clang_cc1 -verify=c89 -pedantic -std=c89 %s
3
+ expected-no-diagnostics
4
+ */
5
+
6
+ /* WG14 ???: Yes
7
+ * Conversion of array to pointer not limited to lvalues
8
+ *
9
+ * NB: the original paper number is unknown, this was gleaned from the editor's report
10
+ * in the C99 foreword. The C99 rationale document did not shed much light on
11
+ * the situation either, mostly talking about user confusion between lvalue and
12
+ * modifiable lvalue. However, the crux of the change was C89 changing:
13
+ *
14
+ * C89 3.2.2.1: Except when it is the operand of ..., an lvalue that has type
15
+ * 'array of type' is converted to an expression that has type 'pointer to
16
+ * type' that points to the initial element of the array object and is not an
17
+ * lvalue.
18
+ *
19
+ * C99 6.3.2.1p3: Except when it is the operand of ..., an expression that has
20
+ * type 'array of type' is converted to an expression with type 'pointer to
21
+ * type' that points to the initial element of the array object and is not an
22
+ * lvalue.
23
+ */
24
+
25
+ struct S {
26
+ char arr [100 ];
27
+ };
28
+
29
+ struct S f (void );
30
+
31
+ void func (void ) {
32
+ char c ;
33
+ /* The return from f() is an rvalue, so this code is not valid in C89, but is
34
+ * valid in C99.
35
+ */
36
+ c = f ().arr [10 ]; /* c89-warning {{ISO C90 does not allow subscripting non-lvalue array}} */
37
+ }
38
+
Original file line number Diff line number Diff line change @@ -360,7 +360,7 @@ <h2 id="c99">C99 implementation status</h2>
360
360
< tr >
361
361
< td > conversion of array to pointer not limited to lvalues</ td >
362
362
< td > Unknown</ td >
363
- < td class ="unknown " align ="center "> Unknown </ td >
363
+ < td class ="full " align ="center "> Yes </ td >
364
364
</ tr >
365
365
< tr >
366
366
< td > relaxed constraints on aggregate and union initialization</ td >
You can’t perform that action at this time.
0 commit comments