>>>>> "Joseph" == Joseph S Myers <jos...@codesourcery.com> writes:
Tom> I wasn't really aware of 6.3.2.1, but after reading it and re-reading Tom> 6.5.1.1, I think I agree with his "model 0" interpretation: no promotion Tom> or conversion. Tom> I don't have a standards-based reason for this, though; just my belief Tom> that _Generic was omitted from 6.3.2.1 by mistake. I re-re-read the sections and came up with a standards-based reason: 6.3 is about conversions, and the first paragraph starts "several operators convert ...". Based on this, and other such phrases in the text, I think the entire section applies to operators. However, _Generic is not called an operator in the text. It is a primary expression. Therefore, 6.3.2 does not apply. This seems plausible to me, if a bit legalistic. Joseph> * Conversion of qualified to unqualified types (which normally Joseph> would occur as part of lvalue-to-rvalue conversion, but might Joseph> also be an issue with casts to qualified types). The given Joseph> example of a cbrt type-generic macro would only work as users Joseph> expect (given that an argument might be a variable of type Joseph> "const long double", or a cast to const long double) if the Joseph> expression (whether lvalue or rvalue) is converted from Joseph> qualified to unqualified type. It seems to me that keeping the qualifiers is obviously more useful. Qualifiers can be stripped in various ways, but once stripped, can't be regained. The cbrt example can be salvaged by adding a few extra generic associations. This can even be easily done via a macro. #define CLAUSE(TYPE, EXPR) \ const TYPE: EXPR, TYPE: EXPR #define cbrt(X) _Generic ((X), CLAUSE (double, ...), ...) Joseph> * Conversion of arrays and function designators to pointers. If the above interpretation is correct then this conversion is not done either. IIUC. Joseph> * GCC doesn't have very well-defined semantics for whether an Joseph> rvalue has a qualified type or not. This only appears as an Joseph> issue with typeof at present, but does require more care about Joseph> eliminating qualifiers for _Generic. Joseph> * build_unary_op has code [...] Thanks. I'll take a look, but these sound a bit scary at first glance. Tom