mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-04 09:14:04 +08:00
* g++.old-deja/g++.other/overload12.C
From-SVN: r37760
This commit is contained in:
parent
25080928b1
commit
e108596275
30
gcc/testsuite/g++.old-deja/g++.other/overload12.C
Normal file
30
gcc/testsuite/g++.old-deja/g++.other/overload12.C
Normal file
@ -0,0 +1,30 @@
|
||||
// Build don't link:
|
||||
// Origin: Neil Booth <neilb@earthling.net> from bug #27.
|
||||
|
||||
struct A{};
|
||||
|
||||
struct B:A{};
|
||||
|
||||
struct C:B{};
|
||||
|
||||
struct CX
|
||||
{
|
||||
C c;
|
||||
|
||||
operator C&(){return c;}
|
||||
};
|
||||
|
||||
// viable functions for call below
|
||||
void f(A&);
|
||||
void f(B&);
|
||||
|
||||
int main()
|
||||
{
|
||||
CX cx;
|
||||
C c;
|
||||
|
||||
f(c); // the standard conversion to B& is better than to A&
|
||||
|
||||
f(cx); // after user defined conversion to C&
|
||||
// the standard conversion to B& is better than to A&
|
||||
}
|
Loading…
Reference in New Issue
Block a user