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

            Bug ID: 38947
           Summary: Attributes cannot be applied to `friend` member
                    function declarations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: vittorio.ro...@outlook.com
                CC: llvm-bugs@lists.llvm.org

The following code snippet:

    struct a
    {
        [[nodiscard]] friend int b();
    };

Produces this error when compiling on `clang++ (trunk 342102)` with
`-std=c++17`:

    <source>:3:5: error: an attribute list cannot appear here
        [[nodiscard]] friend int b();
        ^~~~~~~~~~~~~

Removing `friend` or adding a body to `b` prevents the error. 
Live example on godbolt: https://gcc.godbolt.org/z/ttTDuZ

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to