aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/explicit2.C
blob: a2077bffc2fcf7f5df1e6620071b5ddd0ffd8c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Build don't link:

class string {
public:
  string(const char*) { } 
  explicit string(int size) { }
}; 

void foo(string) { }

string bar() {
  foo("hello");		// ok
  foo(string(2));	// ok
  foo(2);		// ERROR - no implicit conversion from int to string
  string x = 2;		// ERROR - no implicit conversion from int to string
  string y(2);		// ok
  foo((string)2);	// ok
  return 2;		// ERROR - no implicit conversion from int to string
}

class A : string {
public:
  A() : string(2) { }	// ok
};