<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69044>69044</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
diagnostic ignored "-Wexcess-initializers" ignored
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mu578
</td>
</tr>
</table>
<pre>
clang version 16.0.4, I have the following construct (1), when I pass a general -Wno-excess-initializers the warning is cleared, calling on this particular case `diagnostic` doesn't work.
Trying to make a type agnostic initializer. `mu0_is_complex_number` is a _Generic enumeration construct return 1 or 0 if given input is of known complex type.
If someone has a better idea on how to achieve such construct; welcome any, the problem the two expressions are `unequally evaluable` within that scope, however, this is perfectly fine in that context ; either case should be dropped later on, but still branch evaluated prior ; anyways, I don't like the idea of suppressing it globally.
1 -
```
if (declare type complex struct)
x = { _v, 0 }
else
x = { _v }
```
```c
# if MU0_HAVE_GENERIC
# if MU0_HAVE_CC_APLCC || MU0_HAVE_CC_CLANG || MU0_HAVE_CC_ARMCC || MU0_HAVE_CC_MSVCL
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wexcess-initializers"
# endif
# define mu8_ini(_Tp, __x, _v) \
mu0_scope_begin \
((mu0_is_complex_number(__x) == 1) \
? ((__x) = __mu0_extension__ (_Tp) { _v, 0 }) \
: ((__x) = __mu0_extension__ (_Tp) { _v }) \
); \
mu0_scope_end
# if MU0_HAVE_CC_APLCC || MU0_HAVE_CC_CLANG || MU0_HAVE_CC_ARMCC || MU0_HAVE_CC_MSVCL
# pragma GCC diagnostic pop
# endif
# else
# define mu8_ini(_Tp, __x, _v) (_Tp) { _v }
# endif
```
```
example: so obvious the last one cause a warning: excess elements in scalar initializer.
mu0_cfp128_t x1; mu8_ini(mu0_cfp128_t , x1, 0);
mu0_cfpex_t x2; mu8_ini(mu0_cfpex_t , x2, 1);
mu0_cfp64_t x3; mu8_ini(mu0_cfp64_t , x3, 1);
mu0_cfp32_t x4; mu8_ini(mu0_cfp32_t , x4, 1);
mu0_cfp16_t x5; mu8_ini(mu0_cfp16_t , x5, 1);
mu0_sint16_t x6; mu8_ini(mu0_sint16_t , x6, 1);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlt-T2rYTwP8a8bIDY8tg7AceCJe7780kme-kafLokeUFqydLriSD6V_fWRvCQei16VNvPPbZu_rsT60Q3qudQVyxxTu2eJiILtTWrZpuscwmpa2OK6mF2cEenVfWQJzOotmc8Q08Qy32CKFG2Fqt7UGZHUhrfHCdDMB4FjOek-ahRgPP0ArvQcAODTqhYfrN2Cn2Er2fKqOCElr9gc4PxINwhnjKg9QoHFYEkkJr-moNhFp5aIULSnZaOJDCI7A0qpTYGeuDkiyNoLLoDePLAAfrXmYsemDRerx_cUdCBQuNeEEQEI4twnkxvPJoRtymiwrlC2mbVmNfmK4p0ZEJRTEVTxSUkoCma9CJQKm65MJh6JyBGKyDCNQWdmqPBpRpu0AAu4UXYw-0ZMAPvlx5-7wFbxu0BqEWZLHEENCBqlBQOmp7oFCErBXuEXwn64t9lryDA2ppGwRhjpRJynHrbKmxGf4PBwvYtw49VdmDcEM2O4O_d0LrI-Be6E6UGinmgwq1ohqIAF7aFglZ2wPu0Y105SmuFt0WZdBH2CqDcF4irQnYByC_UIUaT-Xzte10BSVC5WzbYgVaUJDWELTsAvigtIbSCSPrk0sBK2idsm7ACXM8iKMf-7OyY-21ehn7dMzWFnzXjqFShwXYaVtSkFcZj2EKp_c0Ol3Dq9pSb1coNSVp6Jpz2U7p5vmoCQA9sOQB2PIdFHtyKgK2fBilqD3e1buo3Fi--ShP7zxhUa628PHXqPjf-uv74un9p_efnzevxTcam02x_v-HzQbYcsOWmyvB5sP609M9wfrzx_srPv7ydfPhxlrrxK4R8LTZwGVLQtv5-h8pqp2xDitgnE-_3RkSjPMbDppKbV9_q3BouqbLCmUU41nxpaUSFEU_PPaM58AW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