summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/mv4.C
blob: 1a7290643acd612039140dc0ac4efe3943101dd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Test case to check if the compiler generates an error message
   when the default version of a multiversioned function is absent
   and its pointer is taken.  */

/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -mno-sse -mno-popcnt" } */

int __attribute__ ((target ("sse")))
foo ()
{
  return 1;
}
int __attribute__ ((target ("popcnt")))
foo ()
{
  return 0;
}

int main ()
{
  int (*p)() = &foo; /* { dg-error "Pointer to a multiversioned function without a default is not allowed" {} } */
  return (*p)();
}