[vlc-devel] [PATCH] Added check for _Static_assert and C++11 static_assert.

Maxim Bublis b at codemonkey.ru
Tue Nov 26 19:39:53 CET 2013


>
> Well, I'm not quite sure how it is possible for the standard C and C++
> libraries to disagree on static_assert() (and all the while the C and C++
> compilers agree on _Static_assert()...). But I cannot blame you for being
> pedantic.
>

Suddenly clang and clang++ is a such pair of compilers (both shipped with
XCode 5.0.2).

Clang:

$ cat test.c
#include <assert.h>
int main() {
    static_assert(1, "This shouldn't happen");
    return 0;
}

$ clang test.c
test.c:3:5: warning: implicit declaration of function 'static_assert' is
invalid in C99 [-Wimplicit-function-declaration]
    static_assert(1, "This shouldn't happen");
    ^
1 warning generated.
Undefined symbols for architecture x86_64:
  "_static_assert", referenced from:
      _main in test-akB09x.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Clang++:

$ cat test.cc
#include <cassert>
int main() {
    static_assert(1, "This shouldn't happen");
    return 0;
}
$ clang++ test.cc
$ echo $?
0


> However, please use configure caching when writing compiler tests.


I'll resubmit patch with configure caching in a few minutes.


-- 
Maxim Bublis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131126/2a3a0a13/attachment.html>


More information about the vlc-devel mailing list