g++ extension for Concepts TS

2017-04-02 Thread Christopher Di Bella
Hey all,

I've been working on a concept extension that permits type aliases
inside the requires-seq.
The grammar addition is fairly simple.

```
requirement-seq
   requirement
   alias-declaration
   requirement-seq requirement
```

Semantically, this change forces a requirement-body to open a new
scope to house the alias.

I've managed to get it working for variable concepts, but not function concepts.

It looks like type aliases for some concepts are tricking the compiler
into thinking that there are multiple statements.
For example:

```cpp
template 
concept bool Foo =
requires(T a) {
   using type = T;
   using value_type = typename std::vector::value_type;
   {a + a} -> value_type;
   {a - a} -> type;
   {a + a} -> typename std::vector::value_type;
   {a - a} -> T;
};
```
works, but

```cpp
template 
concept bool Foo() {
requires(T a) {
   using type = T;
   using value_type = typename std::vector::value_type;
   {a + a} -> value_type;
   {a - a} -> type;
   {a + a} -> typename std::vector::value_type;
   {a - a} -> T;
};
}
```
fails with

```
test.cpp: In function 'concept bool Foo()':
test.cpp:4:14: error: definition of concept 'concept bool Foo()' has
multiple statements
 concept bool Foo() {
  ^~~
test.cpp: In function 'int main()':
test.cpp:17:10: error: deduced initializer does not satisfy
placeholder constraints
  Foo i = 0;
  ^
test.cpp:17:10: note: in the expansion of concept '(Foo)()'
template concept bool Foo() [with T = int]
```

After some inspection, I've deduced that the issue is flagged in
constraint.cc:2527, where a DECL_EXPR is identified, instead of a
RETURN_EXPR.
I'm wondering if it's trivially possible to ignore these declarations?
E.g. a loop that somewhat resembles:

```cpp
while (body != TREE_NULL && TREE_CODE(STATEMENT_LIST_HEAD(body)) ==
DECL_EXPR && is also an alias declaration)
   body = STATEMENT_LIST_TAIL(body);
if (body != TREE_NULL)
  error...
// else cleared of all charges
```

Cheers,

Chris


gcc-7-20170402 is now available

2017-04-02 Thread gccadmin
Snapshot gcc-7-20170402 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/7-20170402/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 7 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/trunk revision 246639

You'll find:

 gcc-7-20170402.tar.bz2   Complete GCC

  SHA256=c87eb948929e11819cf7d599651751fd3eba5db5669d26e35a99bdfdd8710876
  SHA1=f1e8007954d0e91ea7caac49241aea50972ff2d2

Diffs from 7-20170326 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-7
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.