[LLVMbugs] [Bug 7708] New: Partial ordering weird behavior

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jul 25 09:03:28 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7708

           Summary: Partial ordering weird behavior
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: schaub-johannes at web.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


I don't understand the exact rules when non-deduced contexts are involved, but
the following looks weird to me. While this compiles:

// snip
template<typename T>
struct Const { typedef void type; };

template<typename T>
void f(T, typename Const<T>::type*) { } // T1

template<typename T>
void f(T, void *) {  } // T2

int main() { void *p = 0; f(0, p); }
// snap

The following doesn't, claiming an ambiguous call, but does compile on
EDG/comeau and GCC

// snip
template<typename T>
struct Const { typedef void const type; };

template<typename T>
void f(T, typename Const<T>::type*) { } // T1

template<typename T>
void f(T, void const *) {  } // T2

int main() { void *p = 0; f(0, p); }
// snap

// Error output:
main1.cpp:13:3: error: call to 'f' is ambiguous
  f(0, p);
  ^
main1.cpp:5:6: note: candidate function [with T = int]                          
void f(T, typename Const<T>::type*) { } // T1
     ^
main1.cpp:8:6: note: candidate function [with T = int]                          
void f(T, void const*) {  } // T2
     ^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list