[Bug c++/78337] "internal compiler error: Segmentation fault", using local variable in lambda return-type deduction

2016-11-13 Thread aaron.mcdaid at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78337

--- Comment #1 from aaron.mcdaid at gmail dot com ---
Created attachment 40033
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40033=edit
crashing output from gcc 6.2.0

[Bug c++/78337] New: "internal compiler error: Segmentation fault", using local variable in lambda return-type deduction

2016-11-13 Thread aaron.mcdaid at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78337

Bug ID: 78337
   Summary: "internal compiler error: Segmentation fault", using
local variable in lambda return-type deduction
   Product: gcc
   Version: 6.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aaron.mcdaid at gmail dot com
  Target Milestone: ---

Created attachment 40032
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40032=edit
c++ code

The following code generates a "internal compiler error: Segmentation fault".
Code and gcc trace attached.

If I specify that `f` is `constexpr`, then there is not a segmentation fault.
This code began as an attempt to identify at compile time if a given expression
can be treated as a constant expression, but here I have simplified it. (The
full code worked in clang in the manner that I expected. See
http://stackoverflow.com/a/40413051/146041 for more on the context.)

My hunch is that 'f' is the problem here. It is being used in the computation
of the return type of the generic lambda. In this particular codebase, I would
expect a conventional refusal to compile with an error message about the fact
that a constant expression is necessary as the non-type int parameter to the
template Void.


//  g++ (GCC) 6.2.0

struct X {
static constexpr int foo (int b) {
return b;
}
};

template
using Void = void;

template
auto
bar(F f, A a) -> decltype( ( f(a) , 0 ) )
{ return {}; }


int main() {
//constexpr
int f = 3;
(void)f;
auto l = [](auto of_type_X)->
   Void<(decltype(of_type_X)::   foo(f)   ,0)>{return;};
bar( l , X{});
}

[Bug c++/69905] Digit separators break literal operators

2016-10-26 Thread aaron.mcdaid at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69905

aaron.mcdaid at gmail dot com changed:

   What|Removed |Added

 CC||aaron.mcdaid at gmail dot com

--- Comment #3 from aaron.mcdaid at gmail dot com ---
I think this could be fixed by defining the missing overload of `operator""s`
for `unsigned long long`.

As I understand it, the standard requires two overloads, `long double` and
`unsigned long long`. However, only the latter is present in gcc-6.2.0. The
`chrono` file is missing `unsigned unsigned long`, but has the following
instead:

  template 
  constexpr chrono::seconds
  operator""s()
  { return __check_overflow<chrono::seconds, _Digits...>();

This appears to be failing to interpret the separator correctly.

(Apologies if I have misinterpreted, this is my first time looking in the
chrono header!)

[Bug c++/66735] [C++14] lambda init-capture fails for const references

2015-08-10 Thread aaron.mcdaid at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66735

aaron.mcdaid at gmail dot com changed:

   What|Removed |Added

 CC||aaron.mcdaid at gmail dot com

--- Comment #1 from aaron.mcdaid at gmail dot com ---
I'm also seeing the same problem, and another very similar issue:

int main() {
const int x = 0;
auto l = [rx = x]() {};
}

This is rejected by g++ (4.9.3 and 5.2.0) but accepted  by clang. Also
discussed on StackOverflow: http://stackoverflow.com/q/31919260/146041


[Bug c++/63522] [4.8/4.9/5 Regression] ICE: unexpected expression 'ElementIndices' of kind template_parm_index

2015-07-13 Thread aaron.mcdaid at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63522

aaron.mcdaid at gmail dot com changed:

   What|Removed |Added

 CC||aaron.mcdaid at gmail dot com

--- Comment #5 from aaron.mcdaid at gmail dot com ---
Hi,
In which versions has this been fixed? I'm running 4.9.3 and it crashes with
this fragment. I had assumed that 4.9.3 was very up-to-date (as of July 2015).

Perhaps this was fixed in the 5.x series and wasn't included in the recent
4.9.3 release?

I also have a different piece of code that gives a very similar error. I'm not
sure if I've found a new bug or not. In the following code, it will compile
cleanly if I put a return statement inside function template `a`, or if I
replace the return type with the simpler (non-decltype) version that is
currently commented out. Otherwise it crashes with 
unexpected expression ā€˜iā€™ of kind template_parm_index

  ~/prefix-gcc-4.9.3/bin/g++ -std=c++11 -Wall -Wextra


templateint i
struct int_c {
static
constexpr int value = i;
};

templateint... c
struct Pack {
};


templateint... i
static
auto a() -
Pack decltype(int_ci()) :: value ... 
//Pack  int_ci  :: value ... 
{
}

int main() {
a0();
}