[Bug 264730] clang++ -fmodules fails when using stdout from cstdio: error: declaration of '__stdoutp' must be imported from module 'std.iosfwd' before it is required

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 18 Jun 2022 13:39:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264730

Dimitry Andric <dim@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dim@FreeBSD.org

--- Comment #1 from Dimitry Andric <dim@FreeBSD.org> ---
I'm unsure why -fmodules changes this behavior, but __stdoutp is declared in
/usr/include/stdio.h, like:

#ifndef _STDSTREAM_DECLARED
__BEGIN_DECLS
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
__END_DECLS
#define _STDSTREAM_DECLARED
#endif

while there is a similar, but slightly different declaration in
/usr/include/wchar.h:

#ifndef _STDSTREAM_DECLARED
extern FILE *__stdinp;
extern FILE *__stdoutp;
extern FILE *__stderrp;
#define _STDSTREAM_DECLARED
#endif

Though in this file, __BEGIN_DECLS is at the top, and __END_DECLS at the
bottom.

libc++'s <cstdio.h> begins by including <__config>, and then <stdio.h>. I
suspect the former is pulling in <wchar.h>, or something like that?

On the other hand, you might be the very first person to ever try modules on
FreeBSD. There are likely some bumps in the road. :)

-- 
You are receiving this mail because:
You are the assignee for the bug.