Issue 160314
Summary [clang] error with separate preprocess/compilation steps and `-std=c++23 -stdlib=libstdc++`
Labels clang
Assignees
Reporter jdrouhard
    When preprocessing source code and then compiling the preprocessed output with both `-std=c++23` and `-stdlib=libstdc++` from a gcc 15.1.0 installation, it fails with:

```
In file included from test.cc:1:
In file included from /var/compilers/gcc-15.1.0/lib/gcc/x86_64-pc-linux-gnu/15.1.0/../../../../include/c++/15.1.0/chrono:51:
In file included from /var/compilers/gcc-15.1.0/lib/gcc/x86_64-pc-linux-gnu/15.1.0/../../../../include/c++/15.1.0/sstream:42:
In file included from /var/compilers/gcc-15.1.0/lib/gcc/x86_64-pc-linux-gnu/15.1.0/../../../../include/c++/15.1.0/istream:43:
In file included from /var/compilers/gcc-15.1.0/lib/gcc/x86_64-pc-linux-gnu/15.1.0/../../../../include/c++/15.1.0/ostream:44:
/var/compilers/gcc-15.1.0/lib/gcc/x86_64-pc-linux-gnu/15.1.0/../../../../include/c++/15.1.0/format:5165:7: error: variable template 'format_kind' declared with deduced type 'const auto'
      cannot appear in its own initializer
 5165 | format_kind<_Rg>
      |       ^
1 error generated.
```

This seems to be a regression in 21.1.x. This works on 20.1.x with the same gcc installation where the only difference is the clang version. gcc itself also works fine.

Repro:

```sh
echo "#include <chrono>" > test.cc
clang++ -std=c++23 -stdlib=libstdc++ --gcc-toolchain=/var/compilers/gcc-15.1.0 -E -o test.ii test.cc
clang++ -std=c++23 -c -o test.o test.ii
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to