Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.law/arg1.C

raw
1 // { dg-do assemble }
2 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
3 // GROUPS passed arg-matching
4 // arg-matching file
5 // Subject: argument matching depending on the def order
6 // From: [email protected]
7 // Date: Fri, 04 Sep 92 17:41:05 JST
8
9 #include <iostream>
10 // check the order of declarations
11 class A {
12 public:
13 void f(double* p) { std::cout << "A(double*)\n"; } // { dg-message "note" }
14 void f(int* p) { std::cout << "A(int*)\n"; } // { dg-message "note" }
15 };
16
17 class B {
18 public:
19 void f(int* p) { std::cout << "B(int*)\n"; } // { dg-message "note" }
20 void f(double* p) { std::cout << "B(double*)\n"; } // { dg-message "note" }
21 };
22
23 int main()
24 {
25 A a;
26 B b;
27
28 a.f(0);// { dg-error "ambiguous" }
29 b.f(0);// { dg-error "ambiguous" }
30 }
31