PR c++/88741 - wrong error with initializer-string.

* decl.c (cp_complete_array_type): Strip any location wrappers.

	* g++.dg/init/array50.C: New test.

From-SVN: r267656
This commit is contained in:
Marek Polacek 2019-01-07 19:25:41 +00:00 committed by Marek Polacek
parent cc770199de
commit 25a34b0236
4 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2019-01-07 Marek Polacek <polacek@redhat.com>
PR c++/88741 - wrong error with initializer-string.
* decl.c (cp_complete_array_type): Strip any location wrappers.
2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/88261

View File

@ -8433,6 +8433,7 @@ cp_complete_array_type (tree *ptype, tree initial_value, bool do_default)
{
vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (initial_value);
tree value = (*v)[0].value;
STRIP_ANY_LOCATION_WRAPPER (value);
if (TREE_CODE (value) == STRING_CST
&& v->length () == 1)

View File

@ -1,3 +1,8 @@
2019-01-07 Marek Polacek <polacek@redhat.com>
PR c++/88741 - wrong error with initializer-string.
* g++.dg/init/array50.C: New test.
2019-01-07 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/88261

View File

@ -0,0 +1,12 @@
// PR c++/88741
template <class T>
void foo()
{
char row[] = {"test"};
}
void bar()
{
foo<int>();
}