Re: [HACKERS] static assertions in C++ - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] static assertions in C++
Date
Msg-id 463f192b-2adf-5c6f-5798-7813d6be0b80@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] static assertions in C++  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] static assertions in C++
List pgsql-hackers
On 12/11/17 16:45, Tom Lane wrote:
>> I guess the question is whether we would rather be able to have users
>> continue to use older C++ compilers, or be super picky about static
>> assertions.
> 
> Uh, what is this "continue to use" bit?  We've never supported
> building the backend with C++ compilers.

The problem is static assertions in inline functions in header files.
We do support using the header files in C++ extensions.  But now there
is a problem that if a C++ extension happens to pull in a header file
that has a static assertion, it doesn't compile anymore, but it used to
before the static assertion was introduced.

(Currently, we have very few static assertions in header files, so the
problem is not relevant in practice yet, but the use of both static
assertions and inline functions is clearly expanding.)

> (BTW, why is it that we can't fall back on the negative-width-bitfield
> trick for old g++?)

The complaint is

error: types may not be defined in 'sizeof' expressions

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] static assertions in C++
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] static assertions in C++