https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65909

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ugh, I forgot that we sometimes use dg-require-namedlocale with an empty
string. I only checked that the change worked for some tests using non-empty
names.

I don't know why the old code worked when doing:

        set result [${tool}_load "./$exe" "$args" ""]

But the new code expands $args to {} when doing:

        puts $f "  const char *namedloc = transform_locale(\"$args\");"

Some tcl weirdness, I guess.

This works, but is pretty ugly:

--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1048,7 +1048,11 @@ proc check_v3_target_namedlocale { args } {
        puts $f "}"
        puts $f "int main ()"
        puts $f "{"
-       puts $f "  const char *namedloc = transform_locale(\"$args\");"
+       if { [lindex $args 0] == "" } {
+           puts $f "  const char *namedloc = new char\[1\]();"
+       } else {
+           puts $f "  const char *namedloc = transform_locale(\"$args\");"
+       }
        puts $f "  try"
        puts $f "  {"
        puts $f "    locale((const char*)namedloc);"

Reply via email to