diff options
author | Jason Merrill <jason@redhat.com> | 2022-09-12 14:14:24 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-09-12 15:46:59 -0400 |
commit | 6bcca5f642eb950a3cef024ea49a35e4792306f6 (patch) | |
tree | b3dd30c6c6ed9248c4b22d0a19a2711fa0c6e2a7 /gcc/cp | |
parent | 936efcac733fe49e5ea9e636403e5941f24ff1b3 (diff) | |
download | gcc-6bcca5f642eb950a3cef024ea49a35e4792306f6.zip gcc-6bcca5f642eb950a3cef024ea49a35e4792306f6.tar.gz gcc-6bcca5f642eb950a3cef024ea49a35e4792306f6.tar.bz2 |
c++: cast to array of unknown bound [PR93259]
We already know to treat a variable of array-of-unknown-bound type as
dependent, we should do the same for arr{}.
PR c++/93259
gcc/cp/ChangeLog:
* pt.cc (type_dependent_expression_p): Treat a compound
literal of array-of-unknown-bound type like a variable.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist-array17.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/pt.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index ad9c2f9..31e3e39 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -28082,11 +28082,11 @@ type_dependent_expression_p (tree expression) If the array has no length and has an initializer, it must be that we couldn't determine its length in cp_complete_array_type because it is dependent. */ - if (VAR_P (expression) + if (((VAR_P (expression) && DECL_INITIAL (expression)) + || COMPOUND_LITERAL_P (expression)) && TREE_TYPE (expression) != NULL_TREE && TREE_CODE (TREE_TYPE (expression)) == ARRAY_TYPE - && !TYPE_DOMAIN (TREE_TYPE (expression)) - && DECL_INITIAL (expression)) + && !TYPE_DOMAIN (TREE_TYPE (expression))) return true; /* Pull a FUNCTION_DECL out of a BASELINK if we can. */ |