[llvm-bugs] [Bug 48438] New: clang-format confused with class template parametrized by enums

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 8 01:20:30 PST 2020


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

            Bug ID: 48438
           Summary: clang-format confused with class template parametrized
                    by enums
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mateuszalewicki at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Following code is strangely formatted in clang-format 8, 10, 11 (from Ubuntu
repo) with llvm style:
```
template <enum AAAA aaa, BBBB bbb, enum CCC ccc>
class DDD : public EEE, public FFFF {
  public : static constexpr GGG ggg = ccc; static constexpr HHH hhh = ggg;
}
}
;
}

```
Removing `enum` from `enum CCC` gives much better output:
```
template <enum AAAA aaa, BBBB bbb, CCC ccc>
class DDD : public EEE, public FFFF {
public:
  static constexpr GGG ggg = ccc;
  static constexpr HHH hhh = ggg;
}
}
;
}

```
Though `;` in separate line still looks strange.

Possibly related to https://bugs.llvm.org/show_bug.cgi?id=48305 
Both originate in my project, both have problems with mismatching parentheses
and both are worked-around by removing something. I concede this may be
far-fetched connection.

-- 
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/20201208/c8c76d28/attachment-0001.html>


More information about the llvm-bugs mailing list