| 1 |
/* { dg-additional-options "-fdump-tree-gimple" } */ |
| 2 |
|
| 3 |
/* PR c++/118486 */ |
| 4 |
|
| 5 |
struct NotAnInt {}; |
| 6 |
|
| 7 |
// Wrong return type: |
| 8 |
NotAnInt var1(); |
| 9 |
#pragma omp declare variant(var1) match(user={condition(true)}) |
| 10 |
int base1(); |
| 11 |
/* { dg-error "variant 'NotAnInt var1\\(\\)' and base 'int base1\\(\\)' have incompatible types" "" { target *-*-* } .-2 } */ |
| 12 |
|
| 13 |
|
| 14 |
// Wrong return type: |
| 15 |
NotAnInt var2(); |
| 16 |
float var2(float); |
| 17 |
#pragma omp declare variant(var2) match(user={condition(true)}) |
| 18 |
int base2(); |
| 19 |
/* { dg-error "variant 'NotAnInt var2\\(\\)' and base 'int base2\\(\\)' have incompatible types" "" { target *-*-* } .-2 } */ |
| 20 |
|
| 21 |
|
| 22 |
// OK: |
| 23 |
NotAnInt var3(); |
| 24 |
#pragma omp declare variant(var3) match(user={condition(true)}) |
| 25 |
NotAnInt base3(); |
| 26 |
|
| 27 |
void f() |
| 28 |
{ |
| 29 |
// int x; |
| 30 |
NotAnInt y; |
| 31 |
|
| 32 |
//x = base1 (); |
| 33 |
//x = base2 (); |
| 34 |
y = base3 (); |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-final { scan-tree-dump "var3 \\(\\);" "gimple" } } */ |
| 38 |
/* { dg-final { scan-tree-dump-not "base3" "gimple" } } */ |