C11 - noreturn and static_assert

This code snippet makes CLion go crazy (thinking "noreturn" is incorrect, wanting to import it from `<tar.h>`), even though the compiler accepts it:

 

noreturn void i_wont_return_to_caller()
{
exit(EXIT_SUCCESS);
}

 

Same goes for "static_assert", by the way (as reported here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/205822279-Clion-reports-Static-assert-as-error-cant-resolve-symbol-in-C-files-but-works-in-cpp-files- ) :

 

static_assert(sizeof(int*) == 8,
"64-bit code generation not supported");

 

These both use the libraries stdnoreturn.h and assert.h. Changing them to _Noreturn and _Static_assert makes those libraries unused, but results in the same error. 

1 comment
Comment actions Permalink

Hi Etienne.

C11 hasn't been supported in CLion yet. Feel free to comment or upvote the issue in our tracker: https://youtrack.jetbrains.com/issue/CPP-1164.

0

Please sign in to leave a comment.