Opened 11 months ago
Last modified 11 months ago
#293 new defect
String Initialization Cases — at Initial Version
| Reported by: | ajbeach | Owned by: | |
|---|---|---|---|
| Priority: | minor | Component: | cfa-cc |
| Version: | 1.0 | Keywords: | |
| Cc: |
Description
A string literal (possibly enclosed in {})[1] used to initialize an array is treated as a list initializer with the characters in the string (and sometimes the null terminator) as elements in the list. This needs some special handling to be fully handled, and currently there are no special cases to handle that.
This is currently working anyways because (I believe) both array types are decomposed into pointer types and it tries to assign the resulting pointers directly. This gets it to C which does do the special handling. It does become a problem if the type of the string changes[2].
[1] https://en.cppreference.com/w/c/language/array_initialization
[2] https://cforall.uwaterloo.ca/trac/ticket/210