[llvm-bugs] [Bug 26685] New: Possibility for function with cv-qualifier-seq be adjusted to function pointer
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Feb 21 17:31:17 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26685
Bug ID: 26685
Summary: Possibility for function with cv-qualifier-seq be
adjusted to function pointer
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: droffset at yandex.ru
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
Hello!
Simple code:
template <typename T>
struct test
{
typedef void(* type)(T);
};
typedef void foo_t() const;
typedef test<foo_t>::type func_t;
We've got a function type with cv-qualifier-seq acquires the properties of a
function pointer, although it's prohibited by Standard. This behavior occurs in
the entire range of compilers.
Do I understand right that func_t (in this case) is invalid type, and it
shouldn't be compiled?
So we can use it to bypass the restrictions and create a pointer to
cv-qualified function:
template <typename F>
struct create_pointer
{
typedef void func_t(F);
template <typename X>
struct extract
{ typedef X type; };
template <typename X>
struct extract<void(X)>
{ typedef X type; };
typedef typename extract<func_t>::type type;
};
int main()
{
create_pointer<void() const>::type p = 0;
}
--
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/20160222/53d89890/attachment.html>
More information about the llvm-bugs
mailing list