On 4/5/19 12:21 PM, Marek Polacek wrote:
On Fri, Apr 05, 2019 at 10:45:59AM -0600, Martin Sebor wrote:
The change committed yesterday to handle the C++ 2a string literals
as non-type template arguments treats empty string initializers for
trailing pointer array elements as zero. That's of course wrong
because addresses of literals are non-zero.
That patch (r270155) also broke constexpr-63241.C:
Yes, thanks.
constexpr-63241.C: In function ‘int main()’:
constexpr-63241.C:12:16: error: could not convert ‘<brace-enclosed initializer
list>()’ from ‘<brace-enclosed initializer list>’ to ‘A’
12 | {{0}, {0}}};
| ^
| |
| <brace-enclosed initializer list>
We have an initializer for a multidimensional array of A, and somehow the
truncating of the elements breaks it.
This was due to using TYPE_HAS_TRIVIAL_DFLT() to determine
the triviality of just the type of the elements currently being
processed and not considering the type of their elements if they
are an array.
I had run into this error when developing the original patch and
used trivial_type_p() to deal with it but missed the test failure
yesterday after changing to TYPE_HAS_TRIVIAL_DFLT().
Martin