ConceptGCC

Introduction

ConceptGCC is a derivative of the GNU C++ compiler that implements the ConceptC++ language. ConceptC++ makes programming with C++ templates easier, because the compiler can type-check templates when they are defined, so mistakes show up earlier. Real support for Generic Programming also means that many of the template tricks that are needed in standard C++ are no longer necessary, and, yes, it provides much-improved error messages than we get with C++ compilers today.

Features

ConceptGCC includes many ConceptC++ features, all aimed at supporting Generic Programming and making templates easier to write and use. One immediate benefit of ConceptC++ that ConceptGCC illustrates is its ability to produce short, meaningful error messages for errors in the use of templates. For instance, try to compile this code with your current C++ compiler:

#include <list>
#include <algorithm>
using namespace std;
 
void f() {
  list<int> l;
  sort(l.begin(), l.end());
}

You'll probably get pages and pages of errors, at the bottom of which is an error saying that the - operator isn't defined for list iterators. ConceptGCC produces (only) the following error message:

sort.cpp: In function 'void f()':
sort.cpp:7: error: no matching function for call to 'sort(std::_List_iterator<int>, std::_List_iterator<int>)'
<path>: note: candidates are: void std::sort(_Iter, _Iter) [with _Iter = std::_List_iterator<int>] <where clause>
sort.cpp:7: note:   no concept map for requirement 'std::MutableRandomAccessIterator<std::_List_iterator<int> >'

Limitations

ConceptGCC is a prototype, and some ConceptC++ features are not yet implemented . We hope to implement them in the future. The known limitations on the ConceptGCC compiler are:

  • Associated templates and function templates are not implemented.
  • Type-checking of instantiations of generic types (e.g., vector<T>) inside templates is not stable.
  • The ConceptGCC C++ Standard Library (a modified libstdc++) has not been completely converted to use concepts.
  • The compiler is very, very slow and can be rather unstable.
Concepts at BoostCon 2007

BoostCon 2007 will offer many interesting sessions on Boost, C++ libraries, and C++0x, including a half-day, hands-on session with Concepts.

> Read more
ConceptGCC 4.3.0 alpha 6

ConceptGCC 4.3.0 alpha 6 is now available!

> Read more
Concepts talk is available online

Doug Gregor's introductory concepts talk is now available on Google Video

> Read more