jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flylint cuts usefull info from an issue found

randrewy opened this issue · comments

Given the following example:

// main.cpp
#include <vector>
#include "header.h"

int main() {
   test<int>();
}

// header.h
template<typename T>
bool test() {
   T min = std::numeric_limits<T>::min();
   size_t x = 0;
   return x > min; // signed/unsigned comparison here, but real issue is cut from output
}

Compiling it with -Wsign-compare gives this warning that spans over two lines:

$ clang++ -std=c++20 -stdlib=libc++ -Wsign-compare src/main.cpp 
In file included from src/main.cpp:2:
src/header.h:9:14: warning: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
    return x > min;
           ~ ^ ~~~
src/main.cpp:6:5: note: in instantiation of function template specialization 'test<int>' requested here
    test<int>();
    ^
1 warning generated.

However output is cut down to this, making it impossible to understand the issue

image