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

            Bug ID: 47638
           Summary: code compiles (and segfaults) with gcc, but does not
                    compile with clang
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

struct S
{
  auto f()
  {
    return [](){};
  }

  template <typename U = S>
  using FP = decltype(&U::f);
};


int main()
{
  (S().*S::FP<>())();

  return 0;
}

https://wandbox.org/permlink/ZjerOK6U3svPXXfE

This code will compile (and segfault) with gcc 10.1, but will not compile with
clang 10.0.0. I think it's valid code. Playing with parentheses did not work
for me.

prog.cc:15:7: error: invalid use of pointer to member type after .*
 (S().*S::FP<>())();
      ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to