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: unassignedclangb...@nondot.org
          Reporter: redbeard0...@gmail.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to