www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24125] New: ImportC: vector type initializer not understood

https://issues.dlang.org/show_bug.cgi?id=24125

          Issue ID: 24125
           Summary: ImportC: vector type initializer not understood
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: ImportC
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: bugzilla digitalmars.com
          Reporter: schveiguy gmail.com

In GCC, an example of a vector type is declared like this:

```c
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
```

And is used with an initializer/literal like this:

```c
return (__m128){ 0.0f, 0.0f, 0.0f, 0.0f };
```

ImportC doesn't recognize the type as an "brace"-initializable thing.

Also note the error message (Error: unrecognized C initializer `{0.0F, 0.0F,
0.0F, 0.0F}`) is quite confusing, as it does look like a valid initializer in
some contexts. It really should say "Error: C initializer `{0.0F, 0.0F, 0.0F,
0.0F}` cannot be use to initialize type `__m128`"

--
Aug 31 2023