https://bugs.llvm.org/show_bug.cgi?id=40227
Bug ID: 40227
Summary: c11: Accepts invalid program with incompatible
function types.
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Test case (prog.c):
void f()
{
}
int main()
{
void (*g)(int) = 0;
&f == g;
}
Compilation command line:
clang prog.c -Wall -Wextra -std=c11 -pedantic-errors
Observed behaviour:
No error messages outputed.
Expected behaviour:
An error message outputed.
The program is invalid due to the following paragraphs of the standard:
6.5.9/2:
"One of the following shall hold:
— both operands have arithmetic type;
— both operands are pointers to qualified or unqualified versions of
compatible types;
— one operand is a pointer to an object type and the other is a pointer to
a
qualified or unqualified version of void; or
— one operand is a pointer and the other is a null pointer constant."
6.7.6.3/15:
"... If one type has a parameter type list and the other type is specified by
a function definition that contains a (possibly empty) identifier list, both
shall agree in the number of parameters, and the type of each prototype
parameter shall be compatible with the type that results from the
application
of the default argument promotions to the type of the corresponding
identifier. ..."
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs