{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2364","repository_url":"https://api.github.com/repos/Valloric/YouCompleteMe","labels_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2364/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2364/comments","events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2364/events","html_url":"https://github.com/Valloric/YouCompleteMe/issues/2364","id":180721456,"number":2364,"title":"static_assert error crashes YCM","user":{"login":"mikelui","id":9659800,"avatar_url":"https://avatars.githubusercontent.com/u/9659800?v=3","gravatar_id":"","url":"https://api.github.com/users/mikelui","html_url":"https://github.com/mikelui","followers_url":"https://api.github.com/users/mikelui/followers","following_url":"https://api.github.com/users/mikelui/following{/other_user}","gists_url":"https://api.github.com/users/mikelui/gists{/gist_id}","starred_url":"https://api.github.com/users/mikelui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikelui/subscriptions","organizations_url":"https://api.github.com/users/mikelui/orgs","repos_url":"https://api.github.com/users/mikelui/repos","events_url":"https://api.github.com/users/mikelui/events{/privacy}","received_events_url":"https://api.github.com/users/mikelui/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-03T19:12:53Z","updated_at":"2016-10-04T00:30:55Z","closed_at":null,"body":"# Issue Prelude\r\n\r\n**Please complete these steps and check these boxes (by putting an `x` inside\r\nthe brackets) _before_ filing your issue:**\r\n\r\n- [x] I have read and understood YCM's [CONTRIBUTING][cont] document.\r\n- [x] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.\r\n- [x] I have read and understood YCM's [README][readme], **especially the\r\n  [Frequently Asked Questions][faq] section.**\r\n- [x] I have searched YCM's issue tracker to find issues similar to the one I'm\r\n  about to report and couldn't find an answer to my problem. ([Example Google\r\n  search.][search])\r\n- [x] If filing a bug report, I have included the output of `vim --version`.\r\n- [x] If filing a bug report, I have included the output of `:YcmDebugInfo`.\r\n- [x] If filing a bug report, I have included the output of\r\n  `:YcmToggleLogs stderr`.\r\n- [x] If filing a bug report, I have included which OS (including specific OS\r\n  version) I am using.\r\n- [x] If filing a bug report, I have included a minimal test case that reproduces\r\n  my issue.\r\n- [x] **I understand this is an open-source project staffed by volunteers and\r\n  that any help I receive is a selfless, heartfelt _gift_ of their free time. I\r\n  know I am not entitled to anything and will be polite and courteous.**\r\n- [x] **I understand my issue may be closed if it becomes obvious I didn't\r\n  actually perform all of these steps.**\r\n\r\nThank you for adhering to this process! It ensures your issue is resolved\r\nquickly and that neither your nor our time is needlessly wasted.\r\n\r\n# Issue Details\r\n\r\n[If filing a bug report, please include **a list of steps** that describe how to\r\nreproduce the bug you are experiencing. Also include test code if relevant.]\r\n\r\nThe following example crashes YCM in vim (did a :PluginUpdate and recompile just before reporting the issue)\r\n\r\n```C++\r\n#include <iostream>                                                                                 \r\n                                                                                                    \r\ntemplate<int N>                                                                                     \r\nstruct Test                                                                                         \r\n{                                                                                                   \r\n    Test() {                                                                                        \r\n        static_assert(N >= 0);                                                                      \r\n        std::cout << N << std::endl;                                                                \r\n    }                                                                                               \r\n};                                                                                                  \r\n```\r\n\r\n``:YcmDiags``\r\n\r\n```\r\nForcing compilation, this will block Vim until done.\r\nError detected while processing function <SNR>72_ShowDiagnostics[1]..<SNR>72_ForceCompile:\r\nline    9:\r\nTraceback (most recent call last):\r\n  File \"<string>\", line 1, in <module>\r\n  File \"~/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py\", line 558, in HandleFileParseRequest\r\n    self._latest_diagnostics = self._latest_file_parse_request.Response()\r\n  File \"~/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/event_notification.py\", line 65, in Response\r\n    self._cached_response = JsonFromFuture( self._response_future )\r\n  File \"~/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/base_request.py\", line 173, in JsonFromFuture\r\n    response = future.result()\r\n  File \"~/.vim/bundle/YouCompleteMe/third_party/pythonfutures/concurrent/futures/_base.py\", line 404, in result\r\n    return self.__get_result()\r\n  File \"~/.vim/bundle/YouCompleteMe/third_party/pythonfutures/concurrent/futures/_base.py\", line 356, in __get_result\r\n    raise self._exception\r\nrequests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine(\"''\",))\r\nNo warnings or errors detected\r\nPress ENTER or type command to continue\r\n```\r\n\r\nThe following example _DOES NOT_ crash YCM (no errors)\r\n\r\n```C++\r\n#include <iostream>                                                                                 \r\n                                                                                                    \r\ntemplate<int N>                                                                                     \r\nstruct Test                                                                                         \r\n{                                                                                                   \r\n    Test() {                                                                                        \r\n        static_assert(N >= 0, \"N too small\");                                                                      \r\n        std::cout << N << std::endl;                                                                \r\n    }                                                                                               \r\n};                                                                                                  \r\n```\r\n\r\n``:YcmDiags``\r\n\r\n```\r\nForcing compilation, this will block Vim until done.\r\nNo warnings or errors detected\r\nPress ENTER or type command to continue\r\n```\r\n\r\nAny other coding errors seem to be detected correctly in my current configuration.\r\n\r\n```\r\n$ vim --version\r\n\r\nVIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 26 2016 10:00:18)\r\nIncluded patches: 1-13\r\nCompiled by Arch Linux\r\nHuge version with GTK3 GUI.  Features included (+) or not (-):\r\n+acl             +file_in_path    +mouse_sgr       +tag_old_static\r\n+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white\r\n+autocmd         +float           +mouse_urxvt     +tcl/dyn\r\n+balloon_eval    +folding         +mouse_xterm     +termguicolors\r\n+browse          -footer          +multi_byte      +terminfo\r\n++builtin_terms  +fork()          +multi_lang      +termresponse\r\n+byte_offset     +gettext         -mzscheme        +textobjects\r\n+channel         -hangul_input    +netbeans_intg   +timers\r\n+cindent         +iconv           +num64           +title\r\n+clientserver    +insert_expand   +packages        +toolbar\r\n+clipboard       +job             +path_extra      +user_commands\r\n+cmdline_compl   +jumplist        +perl/dyn        +vertsplit\r\n+cmdline_hist    +keymap          +persistent_undo +virtualedit\r\n+cmdline_info    +lambda          +postscript      +visual\r\n+comments        +langmap         +printer         +visualextra\r\n+conceal         +libcall         +profile         +viminfo\r\n+cryptv          +linebreak       +python/dyn      +vreplace\r\n+cscope          +lispindent      +python3/dyn     +wildignore\r\n+cursorbind      +listcmds        +quickfix        +wildmenu\r\n+cursorshape     +localmap        +reltime         +windows\r\n+dialog_con_gui  +lua/dyn         +rightleft       +writebackup\r\n+diff            +menu            +ruby/dyn        +X11\r\n+digraphs        +mksession       +scrollbind      -xfontset\r\n+dnd             +modify_fname    +signs           +xim\r\n-ebcdic          +mouse           +smartindent     -xpm\r\n+emacs_tags      +mouseshape      +startuptime     +xsmp_interact\r\n+eval            +mouse_dec       +statusline      +xterm_clipboard\r\n+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save\r\n+extra_search    -mouse_jsbterm   +syntax          \r\n+farsi           +mouse_netterm   +tag_binary      \r\n   system vimrc file: \"/etc/vimrc\"\r\n     user vimrc file: \"$HOME/.vimrc\"\r\n 2nd user vimrc file: \"~/.vim/vimrc\"\r\n      user exrc file: \"$HOME/.exrc\"\r\n  system gvimrc file: \"/etc/gvimrc\"\r\n    user gvimrc file: \"$HOME/.gvimrc\"\r\n2nd user gvimrc file: \"~/.vim/gvimrc\"\r\n       defaults file: \"$VIMRUNTIME/defaults.vim\"\r\n    system menu file: \"$VIMRUNTIME/menu.vim\"\r\n  fall-back for $VIM: \"/usr/share/vim\"\r\nCompilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      \r\nLinking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm     \r\n```\r\n\r\n``:YcmDebugInfo``\r\n\r\n```\r\nPrinting YouCompleteMe debug information...\r\n-- Server crashed, no debug info from server\r\n-- Server running at: http://127.0.0.1:40145\r\n-- Server process ID: 30459\r\n-- Server logfiles:\r\n--   /tmp/ycm_temp/server_40145_stdout.log\r\n--   /tmp/ycm_temp/server_40145_stderr.log\r\nPress ENTER or type command to continue\r\n```\r\n\r\n``:YcmToggleLogs stderr``\r\n\r\n```\r\n2016-10-03 15:06:10,278 - DEBUG - Global extra conf not loaded or no function YcmCorePreload        \r\n2016-10-03 15:06:11,899 - INFO - Received health request                                            \r\n2016-10-03 15:06:11,906 - INFO - Received filetype completion available request                     \r\n2016-10-03 15:06:22,183 - INFO - Received event notification                                        \r\n2016-10-03 15:06:22,184 - DEBUG - Event name: BufferVisit    \r\n```\r\n\r\nI'm guessing the logs are minimal due to the server crashing.\r\n\r\nOn 64-bit ArchLinux\r\n```\r\n$ uname -a\r\n4.7.5-1-ARCH #1 SMP PREEMPT Sat Sep 24 13:04:22 CEST 2016 x86_64 GNU/Linux\r\n```\r\n\r\nycmd compiled with libclang 3.9 (``./install.py --clang-completer``).\r\n\r\nIf I compile the erroring code with my system clang (3.8.1) I get the correct error/warning message. Untested wtih clang 3.9.\r\n\r\n```\r\n$ clang -std=c++11 -c toy.cpp \r\n\r\ntoy.cpp:7:29: warning: static_assert with no message is a C++1z extension [-Wc++1z-extensions]\r\n        static_assert(N >= 0);\r\n                            ^\r\n                            , \"\"\r\n1 warning generated.\r\n```\r\n\r\nFlags passed to libclang/ycm:\r\n\r\n```python                                                          \r\nflags = [                                                                        \r\n'-Wall',                                                                                                                                \r\n'-std=c++11',                                                                          \r\n'-x',                                                                            \r\n'c++',                                                                           \r\n]    \r\n```\r\n\r\n[cont]: https://github.com/Valloric/YouCompleteMe/blob/master/CONTRIBUTING.md\r\n[code]: https://github.com/Valloric/YouCompleteMe/blob/master/CODE_OF_CONDUCT.md\r\n[readme]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md\r\n[faq]: https://github.com/Valloric/YouCompleteMe/blob/master/README.md#faq\r\n[search]: https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fgithub.com%2FValloric%2FYouCompleteMe%2Fissues%20python%20mac\r\n"},"comment":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/comments/251265501","html_url":"https://github.com/Valloric/YouCompleteMe/issues/2364#issuecomment-251265501","issue_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/2364","id":251265501,"user":{"login":"puremourning","id":10584846,"avatar_url":"https://avatars.githubusercontent.com/u/10584846?v=3","gravatar_id":"","url":"https://api.github.com/users/puremourning","html_url":"https://github.com/puremourning","followers_url":"https://api.github.com/users/puremourning/followers","following_url":"https://api.github.com/users/puremourning/following{/other_user}","gists_url":"https://api.github.com/users/puremourning/gists{/gist_id}","starred_url":"https://api.github.com/users/puremourning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puremourning/subscriptions","organizations_url":"https://api.github.com/users/puremourning/orgs","repos_url":"https://api.github.com/users/puremourning/repos","events_url":"https://api.github.com/users/puremourning/events{/privacy}","received_events_url":"https://api.github.com/users/puremourning/received_events","type":"User","site_admin":false},"created_at":"2016-10-04T00:30:55Z","updated_at":"2016-10-04T00:30:55Z","body":"OK so the patch is trivial and fixes it.\r\n\r\n```\r\n(ycmd-3.5.1-debug) BeniMac:clang ben$ git diff\r\ndiff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp\r\nindex 027bf95..4837018 100644\r\n--- a/tools/libclang/CIndex.cpp\r\n+++ b/tools/libclang/CIndex.cpp\r\n@@ -1243,7 +1243,8 @@ bool CursorVisitor::VisitUnresolvedUsingTypenameDecl(\r\n bool CursorVisitor::VisitStaticAssertDecl(StaticAssertDecl *D) {\r\n   if (Visit(MakeCXCursor(D->getAssertExpr(), StmtParent, TU, RegionOfInterest)))\r\n     return true;\r\n-  if (Visit(MakeCXCursor(D->getMessage(), StmtParent, TU, RegionOfInterest)))\r\n+  if (D->getMessage() /* optional in c++1z */ &&\r\n+      Visit(MakeCXCursor(D->getMessage(), StmtParent, TU, RegionOfInterest)))\r\n     return true;\r\n   return false;\r\n }\r\n```\r\n\r\njust need a test case."}}
{"actor":{"display_login":"puremourning"}}