scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 7541da3df27d27b30d7639c25dfbd0c192ddbd91
parent 9f372e48c6cfbe30974069e3343a856135e43a47
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 13 Apr 2024 12:51:44 -0700

tests/cc: Fix 0225-func.c pointer type

According to C99 6.4.2.2p1, __func__ is declared as array of const
char, so when used as an initializer, it is converted to const char *.

An initializer for a scalar follows the same type constraints as
simple assignment, which for pointers requires that both are to
compatible types, and char and const char are not compatible since
the have different qualifiers.

Diffstat:
Mtests/cc/execute/0225-func.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/cc/execute/0225-func.c b/tests/cc/execute/0225-func.c @@ -1,7 +1,7 @@ int main(void) { - char *p = __func__; + const char *p = __func__; int i; for (i = 0; i < sizeof(__func__); i++) {