]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenCXX/enable_if.cpp
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / CodeGenCXX / enable_if.cpp
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu | FileCheck %s
2
3 // Test address-of overloading logic
4 int test5(int);
5 template <typename T>
6 T test5(T) __attribute__((enable_if(1, "better than non-template")));
7
8 // CHECK: @_Z5test5IiEUa9enable_ifIXLi1EEET_S0_
9 int (*Ptr)(int) = &test5;
10
11 // Test itanium mangling for attribute enable_if
12
13 // CHECK: _Z5test1Ua9enable_ifIXeqfL0p_Li1EEEi
14 void test1(int i) __attribute__((enable_if(i == 1, ""))) {}
15
16 void ext();
17 // CHECK: _Z5test2Ua9enable_ifIXneadL_Z3extvELi0EEEi
18 void test2(int i) __attribute__((enable_if(&ext != 0, ""))) {}
19
20 // CHECK: _Z5test3Ua9enable_ifIXeqfL0p_Li1EEXeqfL0p0_Li2EEEii
21 void test3(int i, int j) __attribute__((enable_if(i == 1, ""), enable_if(j == 2, ""))) {}
22
23 // CHECK: _ZN5test4IdE1fEUa9enable_ifIXeqfL0p_Li1EEXeqfL0p0_Li2EEEi
24 template <typename T>
25 class test4 {
26   virtual void f(int i, int j) __attribute__((enable_if(i == 1, ""))) __attribute__((enable_if(j == 2, "")));
27 };
28
29 template class test4<double>;