diff --git a/src/libclang/libclang_parser.cpp b/src/libclang/libclang_parser.cpp index 04a161cd..14cb6cb5 100644 --- a/src/libclang/libclang_parser.cpp +++ b/src/libclang/libclang_parser.cpp @@ -117,10 +117,16 @@ bool is_absolute(const std::string& file) std::string get_full_path(const detail::cxstring& dir, const std::string& file) { + DEBUG_ASSERT(!dir.empty(), detail::precondition_error_handler{}, + "Either file is absolute or relative to some named dir"); if (is_absolute(file)) // absolute file return file; - else if (dir[dir.length() - 1] != '/' && dir[dir.length() - 1] != '\\') +// GCC fails to understand that the assertion would avoid reaching this line if dir was empty. +#if defined __GNUC__ +# pragma GCC diagnostic ignored "-Warray-bounds" +#endif + if (dir[dir.length() - 1] != '/' && dir[dir.length() - 1] != '\\') // relative needing separator return dir.std_str() + '/' + file; else