[llvm-bugs] [Bug 45256] New: Formatting damages friend declaration for specialization of operator function template

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 19 15:48:49 PDT 2020


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

            Bug ID: 45256
           Summary: Formatting damages friend declaration for
                    specialization of operator function template
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Casey at Carter.net
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 23263
  --> https://bugs.llvm.org/attachment.cgi?id=23263&action=edit
Minimal repro

Formatting this C++ program with clang-format (i.e., using the default style):

  template <class> class S;

  template <class T> bool operator<(S<T> const &x, S<T> const &y) {
    return x.i < y.i;
  }

  template <class T> class S {
    int i = 42;
    friend bool operator< <>(S const &, S const &);
  };

  int main() { return S{} < S{}; }

Transforms the well-formed friend declaration into the ill-formed:

    friend bool operator<<>(S const &, S const &);

-- 
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/20200319/cc04e056/attachment.html>


More information about the llvm-bugs mailing list