http://llvm.org/bugs/show_bug.cgi?id=16872
Bug ID: 16872
Summary: The sizeof operator shall not be applied directly to a
function
Product: clang
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
C++ 2003 standard forbid sizeof operator to function, 5.3.3, [expr.sizeof]:
> 3. The sizeof operator can be applied to a pointer to a function, but shall
> not be applied directly to a function.
> 4. The lvalue-to-rvalue (4.1), array-to-pointer (4.2), and
> function-to-pointer (4.3) standard conversions are not applied to the operand
> of sizeof.
This simple example:
void func() {
}
int main() {
return sizeof(func);
}
produce error C2070: 'void (void)': illegal sizeof operand with MSVC 2012
compiler,
g++ (4.7.3) give error: ISO C++ forbids applying 'sizeof' to an expression of
function type
but no error from clang
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs