[llvm-bugs] [Bug 38236] New: flexible array member in an otherwise empty struct
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jul 19 18:38:25 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38236
Bug ID: 38236
Summary: flexible array member in an otherwise empty struct
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
The code is as follow:
struct ordered_tasks
{
int * pop ();
};
struct A
{
ordered_tasks * tasks[];
int * pop ();
};
int pop_first_bucket;
int * A::pop ()
{
int * out;
int cur_bucket = 0;
do {
if (tasks[0]) {
out = tasks[cur_bucket]->pop();
if (out)
return out;
}
} while (pop_first_bucket);
return 0;
}
clang++ accepts the code, but g++ rejects it:
code0.cpp:8:24: error: flexible array member 'A::tasks' in an otherwise empty
'struct A'
ordered_tasks * tasks[];
^
--
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/20180720/7b0ed21d/attachment.html>
More information about the llvm-bugs
mailing list