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

            Bug ID: 42840
           Summary: struct method pointer definition fails if using
                    decltype to determine the struct type
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: nik...@nolte.dev
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

The code:

template<typename s>
using id = s;

template<typename OUT>
struct Functor {
    auto invoke () {
        return true;
    }
};

int main () {
    Functor<bool> f{};

    bool(Functor<bool>::*working)() = &decltype(f)::invoke;
    bool(decltype(f)::*not_working)() = &decltype(f)::invoke; // doesn't work,
parsing seems to fail
    bool(id<decltype(f)>::*working_decay_t)() = &decltype(f)::invoke; // can
make it work by wrapping into id
    auto working_cast =
static_cast<bool(decltype(f)::*)()>(&decltype(f)::invoke);

}


The error:

<source>:14:23: error: expected unqualified-id
    bool(decltype(f)::*not_working)() = &decltype(f)::invoke;
                      ^

See godbolt: https://godbolt.org/z/IVrbZY

I hope the code speaks for itself, everything i could say here would only be
speculation.

Thanks for taking care!
Cheers

-- 
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