[llvm-bugs] [Bug 41598] New: Trailing return type: *this does not bind to base class reference

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 25 05:14:20 PDT 2019


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

            Bug ID: 41598
           Summary: Trailing return type: *this does not bind to base
                    class reference
           Product: clang
           Version: 8.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: treh at think-cell.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

When using *this in the decltype of a trailing return type, clang does not
consider the base class:

struct B {};
int func(B&);

struct D : B {
    auto memfunc() -> decltype(func(*this));
};

compiles with gcc and msvc, but fails with clang
(https://godbolt.org/z/oBYlyt):

<source>:5:32: error: no matching function for call to 'func'
    auto memfunc() -> decltype(func(*this));
                               ^~~~
<source>:2:5: note: candidate function not viable: cannot convert argument of
incomplete type 'D' to 'B &' for 1st argument
int func(B&);
    ^

-- 
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/20190425/20cb0395/attachment-0001.html>


More information about the llvm-bugs mailing list