[llvm-bugs] [Bug 37721] New: The code does not compile

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 6 17:48:51 PDT 2018


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

            Bug ID: 37721
           Summary: The code does not compile
           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:

#include <iostream>

template <class P>
class ptr
{
public:
  // Picked in C++11 mode.
  template<class T>
  ptr operator- (T) const   
  {  return *this;   }
};

// Picked in default C++ mode.
template<class T1, class T2>
int operator- (const ptr<T1>&, const ptr<T2>&)
{  return 0;   }

int
main ()
{
  ptr <int> a, b;
  std::cout << (b - a) << "\n";
}

It compiles fine with g++. Indeed, the code sample comes from a previous report
https://bugs.llvm.org/show_bug.cgi?id=12961

The report is marked as fixed, but clang++ still does not compile the code.

-- 
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/20180607/03791b45/attachment-0001.html>


More information about the llvm-bugs mailing list