[llvm-bugs] [Bug 41167] New: auto-returning function declarations not matched to friend definitions in template classes

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 20 20:47:42 PDT 2019


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

            Bug ID: 41167
           Summary: auto-returning function declarations not matched to
                    friend definitions in template classes
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: redbeard0531 at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

clang seems to be the only compiler to reject this code:
https://godbolt.org/z/jeXWIy

// fine
constexpr int f();
struct X { 
    friend constexpr int f() { return 42; }
};
auto x = f();

// also fine
constexpr auto g();
struct Y { 
    friend constexpr auto g() { return 42; }
};
auto y = g();

// still fine
constexpr int ff();
template <typename T>
struct XX { 
    friend constexpr int ff() { return 42; }
};
template struct XX<int>;
auto xx = ff();

// boom
constexpr auto gg();
template <typename T>
struct YY { 
    friend constexpr auto gg() { return 42; }
};
template struct YY<int>;
auto yy = gg();

-- 
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/20190321/fb1b0518/attachment.html>


More information about the llvm-bugs mailing list