From 2a6150d93290b8b1e73a577226bd9ee4d298a703 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 16 Oct 2015 01:17:38 +0000 Subject: [Sema] Fix address-of + enable_if overloading logic Previously, our logic when taking the address of an overloaded function would not consider enable_if attributes, so long as all of the enable_if conditions on a given candidate were true. So, two functions with identical signatures (one with enable_if attributes, the other without), would be considered equally good overloads. If we were calling the function instead of taking its address, then the function with enable_if attributes would be preferred. This patch makes us prefer the candidate with enable_if regardless of if we're calling or taking the address of an overloaded function. Differential Revision: http://reviews.llvm.org/D13795 llvm-svn: 250486 --- clang/test/CodeGenCXX/enable_if.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/CodeGenCXX') diff --git a/clang/test/CodeGenCXX/enable_if.cpp b/clang/test/CodeGenCXX/enable_if.cpp index 00c55c77490..e17695b413b 100644 --- a/clang/test/CodeGenCXX/enable_if.cpp +++ b/clang/test/CodeGenCXX/enable_if.cpp @@ -1,4 +1,13 @@ // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-pc-linux-gnu| FileCheck %s + +// Test address-of overloading logic +int test5(int); +template +T test5(T) __attribute__((enable_if(1, "better than non-template"))); + +// CHECK: @_Z5test5IiEUa9enable_ifIXLi1EEET_S0_ +int (*Ptr)(int) = &test5; + // Test itanium mangling for attribute enable_if // CHECK: _Z5test1Ua9enable_ifIXeqfL0p_Li1EEEi -- cgit v1.2.3