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

Reply via email to