[Bug c++/61814] [c++1y] cannot use decltype on captured arg-pack

2014-10-23 Thread oakad at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61814

Alexander Dubov oakad at yahoo dot com changed:

   What|Removed |Added

 CC||oakad at yahoo dot com

--- Comment #1 from Alexander Dubov oakad at yahoo dot com ---
This problem still happens on 4.9.1.

For example, this example works:

int main(int argc, char **argv)
{
int a{5};
float z(0.5);
[a](float z_) - void {
decltype(a) b = a;
}(z);
return 0;
}

But this basic modification fails to compile (g++-4.9.1 -std=gnu++14):

int main(int argc, char **argv)
{
int a{5};
float z(0.5);
[a](auto z_) - void {
decltype(a) b = a;
}(z);
return 0;
}


[Bug c++/61814] [c++1y] cannot use decltype on captured arg-pack

2014-10-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61814

--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org ---
(In reply to Alexander Dubov from comment #1)
 But this basic modification fails to compile (g++-4.9.1 -std=gnu++14):
 
 int main(int argc, char **argv)
 {
 int a{5};
 float z(0.5);
 [a](auto z_) - void {
 decltype(a) b = a;
 }(z);
 return 0;
 }

That seems to be a different issue, and is fixed on trunk.


[Bug c++/61814] [c++1y] cannot use decltype on captured arg-pack

2014-10-23 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61814

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-10-23
 CC||jason at gcc dot gnu.org
  Known to work||5.0
 Ever confirmed|0   |1

--- Comment #3 from Jonathan Wakely redi at gcc dot gnu.org ---
Actually the original problem is fixed on trunk too (but gives a different
error now), so maybe it is the same and can be reduced to:

int main()
{
  int a{5};
  [a](auto z) - void {
decltype(a) b = a;
  }(1);
}

l.cc: In instantiation of ‘main()::lambda(auto:1) [with auto:1 = int]’:
l.cc:6:6:   required from here
l.cc:5:17: error: ‘a’ was not declared in this scope
 decltype(a) b = a;
 ^

The error goes away if the lambda doesn't have a trailing-return-type, or if
it's not a generic lambda.

Jason, is it worth fixing this on the branch? It only affects C++14 mode.