[llvm-bugs] [Bug 47638] New: code compiles (and segfaults) with gcc, but does not compile with clang
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 24 12:26:03 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: janezz55 at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200924/06d8cc8b/attachment.html>
More information about the llvm-bugs
mailing list