| 1 |
// A version of error60.C that first issues an unrelated error |
| 2 |
// to cause the pretty printer prefix to get set, verifying we |
| 3 |
// still print the source line for the "required from here" |
| 4 |
// message correctly in that case. |
| 5 |
// { dg-options "-fdiagnostics-show-caret" } |
| 6 |
|
| 7 |
template <typename Foo> |
| 8 |
struct my_pointer |
| 9 |
{ |
| 10 |
my_pointer (Foo *ptr) // { dg-message " initializing argument 1" } |
| 11 |
: m_ptr (ptr) |
| 12 |
{} |
| 13 |
|
| 14 |
Foo *m_ptr; |
| 15 |
}; |
| 16 |
|
| 17 |
template <typename Foo> |
| 18 |
void test (Foo val) |
| 19 |
{ |
| 20 |
my_pointer<Foo> ptr (val); // { dg-error "invalid conversion from 'int' to 'int\\*'" } |
| 21 |
} |
| 22 |
|
| 23 |
void usage () |
| 24 |
{ |
| 25 |
unrelated_error; // { dg-error "not declared" } |
| 26 |
test<int> (42); // { dg-message " required from here" } |
| 27 |
/* { dg-begin-multiline-output "" } |
| 28 |
unrelated_error; |
| 29 |
^~~~~~~~~~~~~~~ |
| 30 |
{ dg-end-multiline-output "" } */ |
| 31 |
/* { dg-begin-multiline-output "" } |
| 32 |
test<int> (42); |
| 33 |
~~~~~~~~~~^~~~ |
| 34 |
{ dg-end-multiline-output "" } */ |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-begin-multiline-output "" } |
| 38 |
my_pointer (Foo *ptr) |
| 39 |
~~~~~^~~ |
| 40 |
{ dg-end-multiline-output "" } */ |
| 41 |
/* { dg-begin-multiline-output "" } |
| 42 |
my_pointer<Foo> ptr (val); |
| 43 |
^~~ |
| 44 |
| |
| 45 |
int |
| 46 |
{ dg-end-multiline-output "" } */ |
| 47 |
/* { dg-begin-multiline-output "" } |
| 48 |
my_pointer<Foo> ptr (val); |
| 49 |
^~~ |
| 50 |
& |
| 51 |
{ dg-end-multiline-output "" } */ |