aboutsummaryrefslogtreecommitdiff
path: root/unit-tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-21 11:56:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-21 11:56:00 +0200
commit7a528eab1561b0d0d4ec29f98355fe67025ea632 (patch)
tree28a2061f17e3ee625e8674378227a81a8738a6ec /unit-tests
parent3db0756adc641e0a63c4c9f194c4f73cceddd90c (diff)
Add support for derived-to-base function overload resolution
Diffstat (limited to 'unit-tests')
-rw-r--r--unit-tests/function/call.test21
-rw-r--r--unit-tests/function/driver.cxx2
2 files changed, 16 insertions, 7 deletions
diff --git a/unit-tests/function/call.test b/unit-tests/function/call.test
index d459300..003a828 100644
--- a/unit-tests/function/call.test
+++ b/unit-tests/function/call.test
@@ -14,8 +14,15 @@ $* <'print $dummy.qual()' >'abc'
:
$* <'print $qual()' 2>>EOE != 0
buildfile:1:8: error: unmatched call to qual\()
+ info: candidate: dummy.qual\()
EOE
+: derived-base
+: Test derived-to-base overload resolution
+:
+$* <'print $dummy.abs([dir_path] .)' >'false';
+$* <'print $dummy.abs([abs_dir_path] .)' >'true'
+
: variadic
:
# @@ TMP: add some args
@@ -45,22 +52,22 @@ EOE
:
$* <'$dummy0(abc)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to dummy0\(<untyped>)
- info: candidate: dummy0\(), qualified name dummy.dummy0
+ info: candidate: dummy0\(), qualified name dummy.dummy0
EOE
: no-match-type
:
$* <'$dummy1([uint64] 123)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to dummy1\(uint64)
- info: candidate: dummy1\(string), qualified name dummy.dummy1
+ info: candidate: dummy1\(string), qualified name dummy.dummy1
EOE
: ambig
:
$* <'$ambig(abc)' 2>>EOE != 0
buildfile:1:2: error: ambiguous call to ambig\(<untyped>)
- info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
- info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
+ info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
+ info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
EOE
: optional-absent
@@ -111,15 +118,15 @@ EOE
:
$* <'$ambig([bool] true)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to ambig\(bool)
- info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
- info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
+ info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
+ info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
EOE
: print-fovl-variadic
:
$* <'$variadic(abc)' 2>>EOE != 0
buildfile:1:2: error: unmatched call to variadic\(<untyped>)
- info: candidate: variadic\(bool [, ...])
+ info: candidate: variadic\(bool [, ...])
EOE
: member-function
diff --git a/unit-tests/function/driver.cxx b/unit-tests/function/driver.cxx
index ba51662..0708cea 100644
--- a/unit-tests/function/driver.cxx
+++ b/unit-tests/function/driver.cxx
@@ -47,6 +47,8 @@ namespace build2
f[".length"] = &string::size; // Member function.
f[".type"] = &name::type; // Data member.
+ f[".abs"] = [](dir_path d) {return d.absolute ();};
+
// Variadic function with first required argument of type bool. Returns
// number of arguments passed.
//