[Bug libstdc++/91786] New: Clang 8.0.1 can't compile the <filesystem> header on Windows

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug libstdc++/91786] New: Clang 8.0.1 can't compile the <filesystem> header on Windows

rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91786

            Bug ID: 91786
           Summary: Clang 8.0.1 can't compile the <filesystem> header on
                    Windows
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamsupermouse at mail dot ru
  Target Milestone: ---

On Windows, Clang 8.0.1 refuses to compile the <filesystem> header with
following errors:

> In file included from ...\mingw64\include\c++\9.2.0\filesystem:37:
> ...\mingw64\include\c++\9.2.0\bits/fs_path.h:636:31: error: invalid use of incomplete
>       type 'std::filesystem::__cxx11::filesystem_error'
>       _GLIBCXX_THROW_OR_ABORT(filesystem_error(
>                               ^~~~~~~~~~~~~~~~~
> ...\mingw64\include\c++\9.2.0\x86_64-w64-mingw32\bits/c++config.h:177:49: note: expanded
>       from macro '_GLIBCXX_THROW_OR_ABORT'
> #  define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC))
>                                                 ^~~~
> ...\mingw64\include\c++\9.2.0\bits/fs_fwd.h:61:9: note: forward declaration of
>       'std::filesystem::__cxx11::filesystem_error'
>   class filesystem_error;
>         ^
> 1 error generated.

We can prevent Clang from complaining by moving the definition of `class
filesystem_error` a few lines up. It should be at least above the definition of
`u8path()`.