← Back to team overview

kicad-developers team mailing list archive

Re: Improve GLM check to ignore clang (which is working)

 

Hi Seth,

I'm not sure cxx_constexpr would be enough. This just checks the
"N2235" (2007) [1, p13] definition of constexpr is available. This
includes:

...constexpr specifier used in a non-static member function definition
declares that member function to be const...

This is the issue at hand - having two non-static members:

* T FOO::function() const;
* constexpr T FOO::function(); // implicitly const by the C++ spec

Is invalid in C++11 as you end up with two functions that differ only
by return type. The implicit const is removed in C++14, hence it works
again.

Why other compilers allow this in C++11 mode is not clear to me,
unless those compilers can distinguish between "const" and "const but
only because it's constexpr" in order to choose one or the other.

Cheers,

John

[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf

On Sun, Jan 6, 2019 at 3:48 PM Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
>
> Am 2019-01-06 06:03, schrieb Thomas Pointhuber:
> > Hi,
> >
> > at the moment I revert the "Check for incompatible glm version" every
> > time I update the KiCad sources, because I'm using clang instead which
> > is working with the current glm version on arch linux.
> >
> > My Patch binds the GLM check to GCC only, to allow other compilers to
> > work with newer GLM versions.
>
> Note that this is a silent C++14 extension that Clang is implementing.
> GCC also compiles fine with --std=c++14.  If we're going to allow this,
> I'd prefer we enable the option universally across all compilers to
> avoid fracturing.  You might test adding cxx_constexpr to
> target_compile_features to see if this fixes glm for g++.
>
> -Seth
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


References