[llvm-bugs] [Bug 45837] New: "friends can only be classes or functions" should also be diagnosed when trying to befriend a concept

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 7 18:34:24 PDT 2020


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: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200508/c7a53db6/attachment.html>


More information about the llvm-bugs mailing list