[Bug c++/80488] Erroneous error "lambda-expression in template argument"

2018-01-18 Thread arbmind at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80488

Andreas Reischuck  changed:

   What|Removed |Added

 CC||arbmind at gmail dot com

--- Comment #1 from Andreas Reischuck  ---
This bug also hit me.

I found this discussion on Stackoverflow:
https://stackoverflow.com/questions/43213997/why-is-gcc-failing-when-using-lambda-for-non-type-template-parameter

And I can report that VS2017 15.5 and clang 6 can compile this code:

  template
  void x() {}

  void test() {
x<[] {}>();
  }

template is not yet supported.

[Bug c++/68074] New: [C++14] Complex ConstExpr Evaluation

2015-10-23 Thread arbmind at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68074

Bug ID: 68074
   Summary: [C++14] Complex ConstExpr Evaluation
   Product: gcc
   Version: 5.2.0
   URL: http://goo.gl/T7h3Qg
Status: UNCONFIRMED
  Keywords: rejects-valid, wrong-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: arbmind at gmail dot com
  Target Milestone: ---

Please take a look at my constexpr experiment.
http://goo.gl/T7h3Qg

GCC 5.2.0 and 5.1.0 has multiple issues with this code.
It compiles well in all variants on Clang 3.7 and 3.8 snapshots.

The goal of the experiment is to implement a multiplication table at compile
time. Peter Sommerlad showed it on CppCon 2015. Video
https://www.youtube.com/watch?v=DM-RXeiSCmc

This implementation makes much more use of constexpr features of C++14.

The issues are marked with comment in the code.

1. Currently the code compiles, but prints the strings backwards. Generating
the strings at runtime, does not schod this behavior. Clang gets this right as
well.

2. The auto generated copy & move operators of carray do behave different. In
compile time execution only the first element is handled. Using the class at
runtime works well. Clang does the same during compile time.

3. Adding an exception to the string generation triggers a strange compiler
error. "sorry, unimplemented: unexpected AST of kind loop_expr" Clang works
well.

4. GCC does not allow me to use range based for loops for carray. Clang has no
problem with that.

Thanks for all the good work. May my experiment help to improve g++.


[Bug c++/68074] [C++14] Complex ConstExpr Evaluation

2015-10-23 Thread arbmind at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68074

--- Comment #1 from Andreas Reischuck  ---
Fixed some issues in my example.
http://goo.gl/Rxq7TP

The ranged for loops now compile on clang. The problem is not the loop, but the
address calculation.


[Bug c++/120626] New: Wrong type generation with non-type template arguments

2025-06-10 Thread arbmind at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120626

Bug ID: 120626
   Summary: Wrong type generation with non-type template arguments
   Product: gcc
   Version: 15.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: arbmind at gmail dot com
  Target Milestone: ---

Created attachment 61619
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61619&action=edit
Code to reproduce

GCC seems to generate wrong types for non-trivial type generations.

When GCC generated a type with the same amount of pack members and the same
value the type of the non-type template arguments seems to be irrelevant and
the wrong type is generated.

I got this when I tried to build a unit system `UnitValue` and started
implementing unit folding `V*A => W`, `V/A => Ohm` etc. CLANG and MSVC get this
right, but GCC seems to get this wrong for all versions. The code runs with GCC
10.1 up to GCC trunk on Godbolt. - https://gcc_bug.godbolt.org/z/PT145WMxv