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

            Bug ID: 45837
           Summary: "friends can only be classes or functions" should also
                    be diagnosed when trying to befriend a concept
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

https://godbolt.org/z/jntYnj

Given this code:

struct S {
    template<class>
    friend concept fooable;
};

Clang produces this harsh syntax error:

error: expected member name or ';' after declaration specifiers
    friend concept fooable;
           ^

If you try to befriend any other kind of entity -- for example, a variable or
variable template -- Clang gives a much friendlier error message, indicating
that it understands what you were *trying* to do:

error: friends can only be classes or functions
    friend bool fooable_v;
                ^

People are already trying to befriend concepts in the field, so it would be
nice if Clang gave that same friendly error message
(diag::err_unexpected_friend) for the `concept` case, as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to