eclipse-cdt / cdt

Eclipse CDT™ C/C++ Development Tools
http://eclipse.org/cdt
Eclipse Public License 2.0
292 stars 192 forks source link

Improve indexer support for variadic templates #718

Open gvl2023 opened 4 months ago

gvl2023 commented 4 months ago

Indexer flags a valid C++ formatting library call (https://github.com/fmtlib/fmt)?

#include "fmt/format.h"
#include <string>
#include <iostream>

int main() {
    std::string message = fmt::format("The answer is {}.", 42);
    std::cout << message << std::endl;
    return 0;
}

This is the templated function being called:

template <typename... T>
FMT_NODISCARD FMT_INLINE auto format(format_string<T...> fmt, T&&... args)
    -> std::string {
  return vformat(fmt, fmt::make_format_args(args...));
}

This compiles and runs just fine but the call to format is underlined and this is the error:

Invalid arguments ' Candidates are: std::__cxx11::basic_string<char,std::char_traits,std::allocator> format(fmt::v8::basic_format_string<char,fmt::v8::type_identity<#0(...)>::type ...>, #0(...) && ...) std::__cxx11::basic_string<char,std::char_traits,std::allocator> format(const #0 &, fmt::v8::basic_format_string<char,fmt::v8::type_identity<#1(...)>::type ...>, #1(...) && ...)

image

Originally posted by @gvl2023 in https://github.com/eclipse-cdt/cdt/discussions/578

alef75 commented 3 months ago

I confirm this one. I have the same problem

tempest766 commented 1 week ago

This code from https://en.cppreference.com/w/cpp/utility/variant/visit is flagged by the indexer and since it relates to variadic templates I'm just adding it to this bug.

screen

tempest766 commented 1 week ago

addition for above comment... screen