tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: c++20: require gcc12?
Martin Husemann <martin%duskware.de@localhost> writes:
> On Tue, Feb 11, 2025 at 07:30:12AM -0500, Greg Troxel wrote:
>> Martin Husemann <martin%duskware.de@localhost> writes:
>>
>> > This is very strange and probably points at a serious bug in the gcc pkg.
>> > Any chance to investigate details of the configure failure?
>> >
>> > AFAICT there is no c++20 specific test code to compile and the c++
>> > frontend does understand "-std=c++20".
Sorry, I misread does as does not!
> Yes, that is what I meant. The AC_... test used in the pkg does not
> seem to compile anything special for C++20, it checks things up to C++17
> and whether the compiler accepts -std=c++20 (because newer C++ standards
> came with proper feature test macros so there is no need to compile test
> code).
>
> I am trying to reproduce the failure locally on a NetBSD 9 machine.
I think I understand what's going on.
configure.ac in bitcoin passes --std=c++20. And then it looks at
__cplusplus.
gcc10 takes c++20 but does not declare conformance. gcc12 does. (This
argues even more strongly for fixing gcc.mk to require 12.) Is this a
bug in our gcc? I would say it's an upstream issue -- but gcc says that
you need 12 to be compliant with c++20, so not really a bug.
A minimal test program:
----------------------------------------
#include <stdio.h>
int
main()
{
printf("__cplusplus %ld\n", __cplusplus);
return 0;
}
----------------------------------------
#!/bin/sh
for std in 11 14 17 20 23; do
echo "STD ${std}:"
g++ --std=c++${std} -o foo${std} foo.cc
./foo${std}
echo ""
done
----------------------------------------
gcc 12 base, NetBSD current, matches gcc 12 pkgsrc on NetBSD current
STD 11:
__cplusplus 201103
STD 14:
__cplusplus 201402
STD 17:
__cplusplus 201703
STD 20:
__cplusplus 202002
STD 23:
__cplusplus 202100
----------------------------------------
gcc 10 pkgsrc on NetBSD current
./build-foo
STD 11:
__cplusplus 201103
STD 14:
__cplusplus 201402
STD 17:
__cplusplus 201703
STD 20:
__cplusplus 201709
STD 23:
g++: error: unrecognized command-line option ‘--std=c++23’; did you mean ‘--std=c++03’?
__cplusplus 202100
Home |
Main Index |
Thread Index |
Old Index