[llvm-bugs] [Bug 38947] New: Attributes cannot be applied to `friend` member function declarations

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 14 04:26:44 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: vittorio.romeo at outlook.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180914/6088007d/attachment.html>


More information about the llvm-bugs mailing list