Bug 98471 - [11 Regression] libstdc++ fails to build with clang on windows because of filesystem bug
Summary: [11 Regression] libstdc++ fails to build with clang on windows because of fil...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: 11.0
Assignee: Jonathan Wakely
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-29 08:49 UTC by cqwrteur
Modified: 2021-01-14 20:04 UTC (History)
2 users (show)

See Also:
Host:
Target: mingw-w64-x86_64
Build:
Known to work: 10.2.1
Known to fail: 11.0
Last reconfirmed: 2020-12-29 00:00:00


Attachments
working patch to fix the issue (644 bytes, patch)
2020-12-29 08:49 UTC, cqwrteur
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cqwrteur 2020-12-29 08:49:25 UTC
Created attachment 49849 [details]
working patch to fix the issue

#include<filesystem>

int main()
{
	
}

D:\hg\fast_io\.tmp>clang++ -o filesystem filesystem.cc -Ofast -std=c++20 -s
In file included from filesystem.cc:1:
In file included from D:\msys64\mingw64\include\c++\11.0.0\filesystem:45:
D:\msys64\mingw64\include\c++\11.0.0\bits/fs_path.h:252:15: error: invalid use of incomplete type
      'std::filesystem::filesystem_error'
        throw filesystem_error(
              ^~~~~~~~~~~~~~~~~
D:\msys64\mingw64\include\c++\11.0.0\bits/fs_fwd.h:58:9: note: forward declaration of
      'std::filesystem::filesystem_error'
  class filesystem_error;
        ^
In file included from filesystem.cc:1:
In file included from D:\msys64\mingw64\include\c++\11.0.0\filesystem:45:
D:\msys64\mingw64\include\c++\11.0.0\bits/fs_path.h:252:9: error: cannot throw object of incomplete type
      'std::filesystem::filesystem_error'
        throw filesystem_error(
        ^     ~~~~~~~~~~~~~~~~~
D:\msys64\mingw64\include\c++\11.0.0\bits/fs_fwd.h:58:9: note: forward declaration of
      'std::filesystem::filesystem_error'
  class filesystem_error;
        ^
2 errors generated.
Comment 1 cqwrteur 2021-01-13 03:12:06 UTC
Is this possible to fix? Is that anything wrong with the patch I provided?
Comment 2 Jonathan Wakely 2021-01-13 09:33:52 UTC
The bug is already assigned to me so I get emailed about all updates to the bug, so stop CCing my other email addresses.

Being annoying does not persuade me to fix things any faster. Quite the opposite in fact.

I have not applied your patch because I have a better solution, and because I've been on holiday. I'm not on holiday now, but I'm still going to wait because you're annoying.
Comment 3 cqwrteur 2021-01-13 10:12:55 UTC
(In reply to Jonathan Wakely from comment #2)
> The bug is already assigned to me so I get emailed about all updates to the
> bug, so stop CCing my other email addresses.
> 
> Being annoying does not persuade me to fix things any faster. Quite the
> opposite in fact.
> 
> I have not applied your patch because I have a better solution, and because
> I've been on holiday. I'm not on holiday now, but I'm still going to wait
> because you're annoying.

okay. sorry.
Comment 4 GCC Commits 2021-01-14 16:28:02 UTC
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:57a4f5e4eacfbbbd0ca5f1e3f946c27d63e2b533

commit r11-6676-g57a4f5e4eacfbbbd0ca5f1e3f946c27d63e2b533
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 14 14:26:19 2021 +0000

    libstdc++: Define function to throw filesystem_error [PR 98471]
    
    Fix ordering problem on Windows targets where filesystem_error was used
    before being defined.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/98471
            * include/bits/fs_path.h (__throw_conversion_error): New
            function to throw or abort on character conversion errors.
            (__wstr_from_utf8): Move definition after filesystem_error has
            been defined. Use __throw_conversion_error.
            (path::_S_convert<_EcharT>): Use __throw_conversion_error.
            (path::_S_str_convert<_CharT, _Traits, _Allocator>): Likewise.
            (path::u8string): Likewise.
Comment 5 Jonathan Wakely 2021-01-14 16:28:46 UTC
Should be fixed now.
Comment 6 cqwrteur 2021-01-14 20:04:41 UTC
(In reply to Jonathan Wakely from comment #5)
> Should be fixed now.

thank you!