30 lines · cpp
1// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu | FileCheck %s2 3// Test address-of overloading logic4int test5(int);5template <typename T>6T test5(T) __attribute__((enable_if(1, "better than non-template")));7 8// CHECK: @_Z5test5IiEUa9enable_ifILi1EET_S0_9int (*Ptr)(int) = &test5;10 11// Test itanium mangling for attribute enable_if12 13// CHECK: _Z5test1Ua9enable_ifIXeqfL0p_Li1EEEi14void test1(int i) __attribute__((enable_if(i == 1, ""))) {}15 16void ext();17// CHECK: _Z5test2Ua9enable_ifIXneadL_Z3extvELi0EEEi18void test2(int i) __attribute__((enable_if(&ext != 0, ""))) {}19 20// CHECK: _Z5test3Ua9enable_ifIXeqfL0p_Li1EEXeqfL0p0_Li2EEEii21void test3(int i, int j) __attribute__((enable_if(i == 1, ""), enable_if(j == 2, ""))) {}22 23// CHECK: _ZN5test4IdE1fEUa9enable_ifIXeqfL0p_Li1EEXeqfL0p0_Li2EEEi24template <typename T>25class test4 {26 virtual void f(int i, int j) __attribute__((enable_if(i == 1, ""))) __attribute__((enable_if(j == 2, "")));27};28 29template class test4<double>;30