Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 07:08:27 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [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
Message-ID:  <bug-264730-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264730

            Bug ID: 264730
           Summary: clang++ -fmodules fails when using stdout from cstdio:
                    error: declaration of '__stdoutp' must be imported
                    from module 'std.iosfwd' before it is required
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: mgorny@gentoo.org

While trying to figure out a build failure for an LLDB test, I've noticed a
problem with clang++ on FreeBSD.  The minimal reproducer is:

```
#include <cstdio>

int main() {
  std::FILE* f =3D stdout;
  return 0;
}
```

Building with -fmodules fails:

```
$ clang++ -fmodules /tmp/test.cxx=20
/tmp/test.cxx:4:18: error: declaration of '__stdoutp' must be imported from
module 'std.iosfwd' before it is required
  std::FILE* f =3D stdout;
                 ^
/usr/include/stdio.h:241:16: note: expanded from macro 'stdout'
#define stdout  __stdoutp
                ^
/usr/include/wchar.h:184:14: note: declaration here is not visible
extern FILE *__stdoutp;
             ^
1 error generated.
```

The same sample works on Linux (w/ libc++).  I suspect the problem lies
somewhere in FreeBSD headers.

I can also reproduce with git clang (built from
1e67385d28a4462b3badb40373cd05d91f8ebce5) but against system libc++.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-264730-227>