[llvm-bugs] [Bug 37822] New: An unfixed bug?

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jun 16 19:10:08 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180617/94ff3b0a/attachment.html>


More information about the llvm-bugs mailing list