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

From Tom Lane
Subject Re: [HACKERS] static assertions in C++
Date
Msg-id 12800.1513785075@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] static assertions in C++  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] static assertions in C++  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 12/20/17 00:57, Tom Lane wrote:
>> I do not have a well-informed opinion on whether
>> #if defined(__cpp_static_assert) && __cpp_static_assert >= 200410
>> is an appropriate test for static_assert() being available, but I'm
>> pretty suspicious of it because none of my C++ compilers seem to
>> take that path, not even recent stuff like clang 9.0.0.

> For clang, you apparently need to pass -std=c++11 or higher.  With g++
> >=6, that's the default.

Ah.  I did try -std=c++0x on one machine, but forgot to do so with
the newer clang.  That does seem to make it take the static_assert
path on recent macOS.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] replace GrantObjectType with ObjectType
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] taking stdbool.h into use