Skip to content

error: cannot combine with previous 'bool' declaration specifier

As an integral part of the build pipeline at out company, we need a program that writes the string "false\n" to standard output. After exploring our options, we came to the conclusion that While has the right level of abstraction and a feature set fitting the task. This is the program:

bool Bool = false;
return Bool;

Writing a shorter program would conflict our code readability guidelines. After executing

./while.py bootstrap_build_chain.while --output-c bbc.c
clang bbc.c

we got the following error message:

bbc.c:5:7: error: cannot combine with previous 'bool' declaration specifier
    5 |         bool _Bool = false;
      |              ^
bbc.c:5:13: error: expected identifier or '('
    5 |         bool _Bool = false;
      |                    ^
bbc.c:6:9: error: expected expression
    6 |         printf(_Bool ? "true\n" : "false\n");
      |                ^
3 errors generated.
Edited by Konrad Czech