Created
July 11, 2016 10:49
-
-
Save andrey-malets/ef3306e8f695496634db5ea8ede4b1f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| malets@mac:~$ cat 2.cc | |
| constexpr int f() { | |
| int x[] = {0}; | |
| return x[1]; | |
| } | |
| int main(void) { | |
| return f(); | |
| } | |
| malets@mac:~$ clang++ -std=c++14 2.cc | |
| 2.cc:3:10: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds] | |
| return x[1]; | |
| ^ ~ | |
| 2.cc:2:3: note: array 'x' declared here | |
| int x[] = {0}; | |
| ^ | |
| 1 warning generated. | |
| malets@mac:~$ ./a.out | |
| malets@mac:~$ echo $? | |
| 240 | |
| malets@mac:~$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment