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

Kirill Bobyrev via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 5 12:33:56 PDT 2016


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 <mailto: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/20161005/77038cf1/attachment.html>


More information about the cfe-dev mailing list