diff options
Diffstat (limited to 'gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C')
-rw-r--r-- | gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C new file mode 100644 index 000000000..b21b9a36f --- /dev/null +++ b/gcc-4.4.3/gcc/testsuite/g++.dg/mversn12.C @@ -0,0 +1,43 @@ +/* Check if everything is fine if the versioned functions are static + member functions. */ + +/* { dg-do run } */ +/* { dg-options "-O2 -fclone-hot-version-paths" } */ + +int __attribute__ ((version_selector)) +featureTest() +{ + return 1;; +} + +class TestClass +{ + public: + static int foo () + { + return 0; + } + + static int bar () + { + return 1; + } + + int dispatch () + { + int a = __builtin_dispatch (featureTest, + (void*)(&TestClass::foo), + (void*)(&TestClass::bar)); + int b = __builtin_dispatch (featureTest, + (void*)(&TestClass::bar), + (void*)(&TestClass::foo)); + return a * b; + } +}; + +int +main () +{ + TestClass c1; + return c1.dispatch (); +} |