-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile operator
-set srcfile ${testfile}.cc
-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } {
+standard_testfile .cc
+
+if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ {debug c++ additional_flags=-Wno-unused-comparison}] } {
return -1
}
############################################
-if ![runto_main] then {
- perror "couldn't run to breakpoint main"
- continue
+if {![runto_main]} {
+ return
}
# Test global operator
# Test ADL operator
gdb_test "p bc == 1" "= 22" "ADL operator"
gdb_test "p bc == 'a'" "= 23" "ADL operator overload"
-gdb_test "p B::BD::operator== (bc,'a')" "= 24" "Fully qualified explicit operator call"
+gdb_test "p B::BD::operator== (bc,'a')" "= 24" "fully qualified explicit operator call"
# Test operator imported from anonymous namespace
gdb_test "p d == 1" "= 33" "anonymous namespace operator"
# Test that indirectly imported operators work
gdb_test "p l == 1" "= 88"
+
+# Test that we don't fall into an import loop
+gdb_test {p x[0]} {No symbol "operator\[\]" in current context.}