Repository navigation
Description
Summary
The CodeQL C++ extractor (v2.26.0, --mimic mode, --gnu_version 120200) produces parse errors in nearly all translation units when processing a codebase compiled with GCC 12.2.0 paired with a recent LLVM libc++ standard library. The C++ compiler is q++ (QNX SDP 8.0.0), which combines a GCC 12.2.0 frontend with LLVM libc++ headers. All errors are in libc++ system headers (std::__2:: namespace) with no errors in user code. The real q++ compiler compiles every translation unit without issue.
Switching the same codebase to libstdc++ (with the same GCC 12.2.0 version) eliminates all errors.
Environment
| Component | Version |
|---|---|
| CodeQL CLI / extractor | 2.26.0 |
| C++ compiler | q++ from QNX SDP 8.0.0 (GCC 12.2.0 frontend + LLVM libc++) |
| Standard library | LLVM libc++ (namespace std::__2) |
| Host / target | Linux x86_64 |
Symptoms
Errors span multiple libc++ headers and all follow the same pattern: the extractor's internal C++ frontend fails template deduction or SFINAE substitution where GCC 12.2.0 succeeds. Examples:
error: class "std::__2::iterator_traits<std::__2::__wrap_iter<char *>>"
has no member "iterator_category"
error: no instance of overloaded function "std::__2::__search_impl"
matches the argument list
candidate function template failed deduction
error: no instance of constructor
"std::__2::pair<_T1, _T2>::pair [...]" matches the argument list
Reproduction
The real compiler succeeds; the extractor fails:
EXTRACTOR="$CODEQL_BUNDLE/cpp/tools/linux64/extractor"
COMPILER="/path/to/gcc-12.2.0-based-compiler"
cat > test.cpp << 'EOF'
#include <algorithm>
#include <vector>
#include <string>
void f() {
std::vector<char> v(10);
std::fill(v.begin(), v.end(), 0);
std::string s(10, ' ');
std::fill(s.begin(), s.end(), 'x');
}
EOF
"$COMPILER" -std=c++17 -c test.cpp -o /dev/null # exit 0
"$EXTRACTOR" --mimic "$COMPILER" --object_filename /dev/null \
--error_limit 1000 -std=c++17 -c test.cpp -o /dev/null 2>&1 | grep "error:"Root Cause
The extractor's internal C++ frontend does not fully replicate GCC 12.2.0's template deduction and SFINAE substitution behavior when processing recent LLVM libc++ headers. This manifests across multiple libc++ internals — iterator traits (__wrap_iter), algorithm SFINAE guards (__enable_if_t), and conditional constructors (pair, optional) — but the underlying cause is the same: the extractor frontend reaches different SFINAE outcomes than GCC 12.2.0.
What works
- GCC 12.2.0 + libstdc++: 0 extraction errors
- GCC 11.4 + LLVM 14 libc++: 0 extraction errors (older libc++, different SFINAE patterns)
Activity
jketema commentedon Sep 4, 2026
Note that
q++is not a supported compiler. That being said, we have been working on a large update to our frontend, which will be part of CodeQL 2.27.1. This version should be released in three or four weeks, and will have a number of fixes in this area.I'm going to close this issue. If the problem persist with CodeQL 2.27.1, please open a new issue.
jketema commentedon Sep 4, 2026
Note btw that the provided test case is not sufficient for us to reproduce the problem, as we do not know what your standard headers look like. A useful test case is ideally self-contained, and can be created by first preprocessing the test with the
-Ecompiler option, and then reducing the resulting file with a tool likecreduceorcvise.