diff options
author | Keith Seitz <keiths@redhat.com> | 2017-04-27 15:55:26 -0700 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2017-04-27 15:58:54 -0700 |
commit | e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f (patch) | |
tree | 56889ea84864e52062ebec7bfa090119c52ff871 /gdb/testsuite/gdb.cp/oranking.exp | |
parent | 5b66fac4bad619766fb1a5f5179c08b67d48a8c5 (diff) | |
download | fsf-binutils-gdb-e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f.zip fsf-binutils-gdb-e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f.tar.gz fsf-binutils-gdb-e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f.tar.bz2 |
Fix overload resolution involving rvalue references and cv qualifiers.
The following patch fixes several outstanding overload resolution problems
with rvalue references and cv qualifiers in the test suite. The tests for
these problems typically passed with one compiler version and failed with
another. This behavior occurs because of the ordering of the overloaded
functions in the debug info. So the first best match "won out" over the
a subsequent better match.
One of the bugs addressed by this patch is the failure of rank_one_type to
account for type equality of two overloads based on CV qualifiers. This was
leading directly to problems evaluating rvalue reference overload quality,
but it is also highlighted in gdb.cp/oranking.exp, where two test KFAIL as
a result of this shortcoming.
I found the overload resolution code committed with the rvalue reference
patch (f9aeb8d49) needlessly over-complicated, and I have greatly simplified
it. This fixes some KFAILing tests in gdb.exp/rvalue-ref-overload.exp.
gdb/ChangeLog
* gdbtypes.c (LVALUE_REFERENCE_TO_RVALUE_BINDING_BADNESS)
DIFFERENT_REFERENCE_TYPE_BADNESS): Remove.
(CV_CONVERSION_BADNESS): Define.
(rank_one_type): Remove overly restrictive rvalue reference
rank checks.
Add cv-qualifier checks and subranks for type equality.
* gdbtypes.h (REFERENCE_CONVERSION_RVALUE,
REFERENCE_CONVERSION_CONST_LVALUE, CV_CONVERSION_BADNESS,
CV_CONVERSION_CONST, CV_CONVERSION_VOLATILE): Declare.
gdb/testsuite/ChangeLog
* gdb.cp/oranking.cc (test15): New function.
(main): Call test15 and declare additional variables for testing.
* gdb.cp/oranking.exp: Remove kfail status for "p foo4(&a)" and
"p foo101('abc')" tests.
* gdb.cp/rvalue-ref-overloads.exp: Remove kfail status for
"lvalue reference overload" test.
* gdb.cp/rvalue-ref-params.exp: Remove kfail status for
"print value of f1 on Child&& in f2" test.
Diffstat (limited to 'gdb/testsuite/gdb.cp/oranking.exp')
-rw-r--r-- | gdb/testsuite/gdb.cp/oranking.exp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.cp/oranking.exp b/gdb/testsuite/gdb.cp/oranking.exp index 69efb0c..dc7c78b 100644 --- a/gdb/testsuite/gdb.cp/oranking.exp +++ b/gdb/testsuite/gdb.cp/oranking.exp @@ -48,7 +48,6 @@ gdb_test "p test3()" "21" gdb_test "p foo3(1.0f)" "21" gdb_test "p test4()" "24" -setup_kfail "gdb/12098" *-*-* gdb_test "p foo4(&a)" "24" gdb_test "p test5()" "26" @@ -71,7 +70,6 @@ setup_kfail "gdb/12098" *-*-* gdb_test "p foo10(amp)" "216" gdb_test "p test101()" "218" -setup_kfail "gdb/12098" *-*-* gdb_test "p foo101(\"abc\")" "218" gdb_test "p test11()" "32" @@ -91,5 +89,8 @@ gdb_test "p test14()" "46" setup_kfail "gdb/12096" *-*-* gdb_test "p foo14(e)" "46" - - +gdb_test "p test15 ()" "194" +gdb_test "p foo15 (c)" "47" +gdb_test "p foo15 (cc)" "48" +gdb_test "p foo15 (vc)" "49" +gdb_test "p foo15 (cvc)" "50" |