Skip to content

#include <complex> fails to compile when using std=c++23 with libstdc++ and gcc 15.1 #139435

Closed as duplicate of#139067
@chriselrod

Description

@chriselrod

Test file, complex.cpp:

#include <complex>

int main(){
  return 0;
}

I get

❯ clang++ -stdlib=libstdc++ -std=c++20 complex.cpp

❯ clang++ -stdlib=libstdc++ -std=c++23 complex.cpp
In file included from format.cpp:1:
In file included from /usr/lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/complex:50:
In file included from /usr/lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/sstream:42:
In file included from /usr/lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/istream:43:
In file included from /usr/lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/ostream:44:
/usr/lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/format:5118:7: error: variable template 'format_kind' declared with deduced type 'const auto' cannot appear in its own initializer
 5118 |       format_kind<_Rg> // you can specialize this for non-const input ranges
      |       ^
1 error generated.

❯ g++ -std=c++23 complex.cpp

❯ g++ --version
g++ (GCC) 15.1.1 20250425
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


❯ clang++ --version
clang version 21.0.0git ([email protected]:llvm/llvm-project.git 066bc49f764cb24c8847d83a059684e3b6d7f4da)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/chriselrod/.local/stow/llvm/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:edgDoes the clang frontend diverge from edg compilerdiverges-from:gccDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueduplicateResolved as duplicatelibstdc++GNU libstdc++ C++ standard library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions