On Tue, 1 Feb 2022 at 09:15, Jonathan Wakely <jwak...@redhat.com> wrote:
>
> On Mon, 31 Jan 2022 at 22:45, Ron Olson <tachokni...@gmail.com> wrote:
> >
> > Hey all,
> >
> > I’m troubleshooting an issue and came up with this sample program: 
> > https://pastebin.com/g9S8Z64q to demonstrate the problem.

That's not a valid C++ program, even in C++23 after <stdatomic.h> is added.

For C++23 it needs to be _Atomic(int) because in C++ _Atomic is not a
type qualifier (unlike in C). Clang supports the _Atomic qualifier in
C++ mode, but that's non-standard.

This code is not portable to any compiler except Clang, and is no
longer even portable to Clang when using G++ in C++23 mode.

I suppose we could enable the contents of <stdatomic.h> for the
non-strict -std=gnu++XX modes before C++23, but you'd still need to
adjust your program to use _Atomic(int) instead of _Atomic int.

Why not just write it in proper C++, using std::atomic<int> or the
atomic_int typedef instead?
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to