[cfe-dev] clang-format indents template methods with ref-qualification + noexcept wrongly.

Han Wang via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 6 03:37:56 PDT 2016


I tried again with the latest version r283423 on mac and it is still the
same. The options are "-i -style=google".

struct A {
  template <typename T>
      void foo(T&& t) & noexcept;
};

On Thu, Oct 6, 2016 at 10:02 AM, Han Wang <wanghan02 at gmail.com> wrote:

> It's windows installer based on SVN r282394 (26 September 2016).
>
> On Wed, Oct 5, 2016 at 9:33 PM, Kirill Bobyrev <kbobyrev.lists at gmail.com>
> wrote:
>
>> Please at least specify major version of clang-format. Mine handles this
>> piece of code just fine (4.0-dev r283306).
>>
>>>> Kirill
>>
>> On 5 Oct 2016, at 18:30, Han Wang via cfe-dev <cfe-dev at lists.llvm.org>
>> wrote:
>>
>> Sorry the semicolon is missing at the end of class definition but it
>> doesn't change the result.
>>
>> On Wed, Oct 5, 2016 at 4:45 PM, Han Wang <wanghan02 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> Let's say we have a simple template method with ref-qualification and
>>> noexcept.
>>>
>>> struct A {
>>>   template <typename T>
>>>   void foo(T&& t) & noexcept {
>>>     DoSomething();
>>>     DoSomethingElse();
>>>   }
>>> }
>>>
>>> If we use clang-format to re-format the code with google style (or llvm
>>> or other styles), we get
>>>
>>> struct A {
>>>   template <typename T>
>>>       void foo(T&& t) & noexcept {
>>>     DoSomething();
>>>     DoSomethingElse();
>>>   }
>>> }
>>>
>>> If we remove the noexcept or if we put a const before ref-qualification
>>> the reformat will work correctly.
>>>
>>>
>>>
>>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161006/d2516d1d/attachment.html>


More information about the cfe-dev mailing list