https://bugs.llvm.org/show_bug.cgi?id=37822

            Bug ID: 37822
           Summary: An unfixed bug?
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

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);
}

It comes from a previous bug report: https://bugs.llvm.org/show_bug.cgi?id=8650

It is said to be fixed. However, when I compile the above code with the latest
clang++, it produces the following errors:


/home/haozhong/project/approach/otherreport/llvm/tmp/llvm_8650/code0.c.cpp:7:2:
error: no matching member function for call to '_M_check'
     _M_check<_Nm>(n);
     ^~~~~~~~~~~~~
   
/home/haozhong/project/approach/otherreport/llvm/tmp/llvm_8650/code0.c.cpp:14:4:
note: in instantiation of member function 'array<double, 3>::at' requested here
     a.at(0);
       ^
   
/home/haozhong/project/approach/otherreport/llvm/tmp/llvm_8650/code0.c.cpp:9:56:
note: candidate template ignored: substitution failure [with _Mm = 3]: non-type
template argument evaluates to 3, which cannot be narrowed to type 'bool'
     template<int _Mm> typename enable_if<_Mm, void>::type _M_check(int) const
{ }
                                          ~~~              ^
    1 error generated.

Is the bug not fully fixed?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to