aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/declare-variant-11.C
blob: 56b2556416c830f1cef4f9a7298fa58f5c80e30c (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* { dg-additional-options "-fdump-tree-gimple" }  */

/* PR c++/118486  */

struct NotAnInt {};

// Wrong return type:
NotAnInt var1();
#pragma omp declare variant(var1) match(user={condition(true)})
int base1();
/* { dg-error "variant 'NotAnInt var1\\(\\)' and base 'int base1\\(\\)' have incompatible types" "" { target *-*-* } .-2 } */


// Wrong return type:
NotAnInt var2();
float var2(float);
#pragma omp declare variant(var2) match(user={condition(true)})
int base2();
/* { dg-error "variant 'NotAnInt var2\\(\\)' and base 'int base2\\(\\)' have incompatible types" "" { target *-*-* } .-2 } */


// OK:
NotAnInt var3();
#pragma omp declare variant(var3) match(user={condition(true)})
NotAnInt base3();

void f()
{
  // int x;
  NotAnInt y;

  //x = base1 ();
  //x = base2 ();
  y = base3 ();
}

/* { dg-final { scan-tree-dump "var3 \\(\\);" "gimple" } }  */
/* { dg-final { scan-tree-dump-not "base3" "gimple" } }  */