0

Platform: Win 10 64 bit IDE: CLION 2022.2.4 Toolchain: VS 2022 Community Toolset v17.0 (CMAKE 3.23.2) Build Tool ninja.exe C++ compiler: cl.exe

#include <iostream>
#include <string>
#include <format>
    
int main() {
    std::wstring test1 = L"Hällo, ";
    std::wstring test2;
    
    std::cout << std::format("Hello {}\n", "world!");
    std::cout << std::format("Hello {}\n", "world!");
}

Errors shown in editor: Error in first format Error in first string Error in second string

I suspect this is a CLang error, but I'm not quite sure. I can compile the code just fine and I get an output to the console. But why do I get an error here?

I tried to find anything on Google on it, but I didn't find anything on this specific error. I know from a friend of mine that this is not an isolated issue, or at least he has the same issue.

From what I read the "consteval" was somewhat newly introduced and might still be incompletely implemented in some library functions?

vitaut
  • 49,672
  • 25
  • 199
  • 336
J. Baumann
  • 13
  • 5

1 Answers1

0

The compiler that your editor uses for highlighting and intellisense doesn't support those features yet.

std::format is a c++20 feature. According to this page it is not yet supported in Clang. This has been discussed here.

Eljas Hyyrynen
  • 233
  • 1
  • 11
  • Aaah, okay. Damn, in my search it didn't even cross my mind, that this is a new feature. Okay, that explains it, I guess. – J. Baumann Oct 28 '22 at 10:21
  • Correct. Could you please approve my answer if it answered your question? Thank you and good luck :) – Eljas Hyyrynen Oct 28 '22 at 11:22
  • Would that be "clang-tidy" that is causing those problems? – J. Baumann Oct 28 '22 at 11:39
  • @J.Baumann yes, I think so. You can try updating that extension or turning it off. You can find the settings for `clang-tidy` in `Settings/Preferences | Editor | Inspections | C/C++ | General | Clang-Tidy`. I hope it helps. – Eljas Hyyrynen Oct 29 '22 at 18:52