Skip to content

C/C++: extractor gets catastrophic error #21242

@hello123leo

Description

@hello123leo

clang++ version: 17.0.6 or 21.1.5
codeql version: 2.24.0

main.cpp

#include <stdint.h>
#include <iostream>
#include <string>

struct TestStruct {
public:
  operator uint32_t() const;

  TestStruct& operator=(const uint32_t v) __attribute__((enable_if(v == v, "test..."))) {
    return *this;
  }
};

int main(int argc, char* argv[]){
    std::cout<<std::is_copy_assignable<TestStruct>::value<<std::endl;
    return 0;
}

create database command:

codeql database create --language=cpp --threads=0 --command='clang++-17 main.cpp -stdlib=libc++ -lc++abi' -- /root/codeqltest/db

build-tracer.log:

CodeQL C++ extractor: Current location: main.cpp:19280,113
CodeQL C++ extractor: Current physical location: /usr/lib/llvm-17/bin/../include/c++/v1/__type_traits/is_copy_assignable.h:27,113
"/usr/lib/llvm-17/bin/../include/c++/v1/__type_traits/is_copy_assignable.h", line 27: internal error: assertion failed at: "overload.c", line 18641 in prep_special_selector_operand

            __is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
                                                                                                                  ^

[E 06:42:45 471327] Warning[extractor-c++]: In construct_text_message: "/usr/lib/llvm-17/bin/../include/c++/v1/__type_traits/is_copy_assignable.h", line 27: internal error: assertion failed at: "overload.c", line 18641 in prep_special_selector_operand

            __is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
                                                                                                                  ^


1 catastrophic error detected in the compilation of "main.cpp".
Compilation aborted.

I tried compiling with clang++ 21.1.5, but I’m still seeing the same error.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions