[LLVMbugs] [Bug 8650] New: no implicit conversion in template values

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 18 15:18:36 PST 2010


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

           Summary: no implicit conversion in template values
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: marc.glisse at normalesup.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


This code (from libstdc++ in gcc-4.2) fails to compile. Is it on purpose?

template<bool, typename> struct enable_if {};
template<typename T> struct enable_if<true,T> {
 typedef T type;
};
template<typename _Tp, int _Nm> struct array {
 void at(int n) {
  _M_check<_Nm>(n);
 }
 template<int _Mm> typename enable_if<_Mm, void>::type _M_check(int) const { }
 // template<int _Mm> typename enable_if<_Mm!=0, void>::type _M_check(int)
const { }
};
int main(){
 array<double,3> a;
 a.at(0);
}


bug.cpp:7:3: error: no matching member function for call to '_M_check'
  _M_check<_Nm>(n);
  ^~~~~~~~~~~~~
bug.cpp:14:4: note: in instantiation of member function 'array<double, 3>::at'
requested here
 a.at(0);
   ^
bug.cpp:9:56: note: candidate template ignored: substitution failure [with _Mm
= 3]
 template<int _Mm> typename enable_if<_Mm, void>::type _M_check(int) const { }
                                                       ^

-- 
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