How do I build gcc with C++ concepts ("concepts lite") support?

Dietmar Kühl picture Dietmar Kühl · May 17, 2015 · Viewed 8.3k times · Source

The C++ standards committee is working on a TS (Technical Specification) for Concepts extension: "Programming Languages - C++ Extensions for Concepts". N4377 is the latest version of this document. For inclusion into the C++ standard features are asked to be implemented, ideally for a publicly accessible system.

I'm aware of concept-gcc but the concepts proposal above (colloquially referred to as Concepts Lite) is different. I heard that there is a concepts branch and I have tried the origin/asutton/c++-concepts from gcc's git mirror but that didn't compile. How do I build and use a version of gcc supporting concepts as specified in the above [draft] TS?

Answer

Yakk - Adam Nevraumont picture Yakk - Adam Nevraumont · Aug 26, 2015

As of Fri, 7 Aug 2015 01:44:49 -0400 (05:44 +0000) concepts support has been merged into gcc's trunk.

Using a build from after that point, you can enable concepts support with the -std=c++1z flag.

As of gcc 6.1 (27-04-2016), concepts are enabled by -fconcepts as they are unlikely to be included in C++17, so they have been removed from -std=c++1z. (via @BruceAdams in comments below)