Mark Mitchell | 6481daa | 2003-05-01 02:02:59 +0000 | [diff] [blame] | 1 | // { dg-do assemble } |
Jeff Law | 921e5a0 | 1997-08-19 01:34:40 -0600 | [diff] [blame] | 2 | // GROUPS passed arg-matching |
Jeff Law | 921e5a0 | 1997-08-19 01:34:40 -0600 | [diff] [blame] | 3 | // From: gustavo@cpqd.br (Gustavo Chaves) |
| 4 | // Date: Wed, 25 May 94 09:38:00 EST |
| 5 | // Subject: problem with user defined conversions in initialization |
| 6 | // Message-ID: <9405251238.AA19815@moon.cpqd.br> |
| 7 | |
| 8 | struct String { String(const char*); }; |
| 9 | |
| 10 | struct Ack { Ack(String); }; |
| 11 | |
Nathan Froyd | feb6efc | 2010-12-08 21:37:51 +0000 | [diff] [blame] | 12 | struct S { void method(Ack); }; // { dg-message "S::method|no known conversion" } referenced below |
Jeff Law | 921e5a0 | 1997-08-19 01:34:40 -0600 | [diff] [blame] | 13 | |
| 14 | void function(Ack); |
| 15 | |
| 16 | int |
| 17 | foo(S *o) |
| 18 | { // Neither call has a usable constructor for conversions of char[5] to Ack. |
Jason Merrill | f8f1227 | 2011-03-16 16:03:56 -0400 | [diff] [blame] | 19 | function("adsf");// { dg-error "could not convert" } |
David Malcolm | 4911b24 | 2018-09-12 18:50:08 +0000 | [diff] [blame] | 20 | o->method("adsf");// { dg-error "cannot convert" } |
Jeff Law | 921e5a0 | 1997-08-19 01:34:40 -0600 | [diff] [blame] | 21 | return 0; |
| 22 | } |