[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / mv15.C
blobc0beadf16ea055d7ea32de3ad28615db14b86855
1 /* Test case to check if Multiversioning works.  */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-require-ifunc "" }  */
4 /* { dg-options "-O2 -fPIC -march=x86-64" } */
6 #include <assert.h>
8 /* Default version.  */
9 int foo (); // Extra declaration that is merged with the second one.
10 int foo () __attribute__ ((target("default")));
12 int foo () __attribute__ ((target("arch=nehalem")));
14 int (*p)() = &foo;
15 int main ()
17   int val = foo ();
18   assert (val ==  (*p)());
20   /* Check in the exact same order in which the dispatching
21      is expected to happen.  */
22   if (__builtin_cpu_is ("corei7"))
23     assert (val == 5);
24   else
25     assert (val == 0);
26   
27   return 0;
30 int __attribute__ ((target("default")))
31 foo ()
33   return 0;
36 int __attribute__ ((target("arch=nehalem")))
37 foo ()
39   return 5;