[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function use of static constexpr array type whos initializer defines the size since r13-2540

2024-06-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

--- Comment #9 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Patrick Palka
:

https://gcc.gnu.org/g:33a9c4dd5fcac7e3f5d835b35fe787126339dd2b

commit r14-10357-g33a9c4dd5fcac7e3f5d835b35fe787126339dd2b
Author: Patrick Palka 
Date:   Tue Jun 25 10:42:21 2024 -0400

c++: using non-dep array var of unknown bound [PR115358]

For a non-dependent array variable of unknown bound, it seems we need to
try instantiating its definition upon use in a template context for sake
of proper checking and typing of the overall expression, like we do for
function specializations with deduced return type.

PR c++/115358

gcc/cp/ChangeLog:

* decl2.cc (mark_used): Call maybe_instantiate_decl for an array
variable with unknown bound.
* semantics.cc (finish_decltype_type): Remove now redundant
handling of array variables with unknown bound.
* typeck.cc (cxx_sizeof_expr): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/template/array37.C: New test.

Reviewed-by: Jason Merrill 
(cherry picked from commit e3915c1ad56591cbd68229a64c941c38330abd69)

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function use of static constexpr array type whos initializer defines the size since r13-2540

2024-06-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

--- Comment #8 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:e3915c1ad56591cbd68229a64c941c38330abd69

commit r15-1614-ge3915c1ad56591cbd68229a64c941c38330abd69
Author: Patrick Palka 
Date:   Tue Jun 25 10:42:21 2024 -0400

c++: using non-dep array var of unknown bound [PR115358]

For a non-dependent array variable of unknown bound, it seems we need to
try instantiating its definition upon use in a template context for sake
of proper checking and typing of the overall expression, like we do for
function specializations with deduced return type.

PR c++/115358

gcc/cp/ChangeLog:

* decl2.cc (mark_used): Call maybe_instantiate_decl for an array
variable with unknown bound.
* semantics.cc (finish_decltype_type): Remove now redundant
handling of array variables with unknown bound.
* typeck.cc (cxx_sizeof_expr): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/template/array37.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function use of static constexpr array type whos initializer defines the size since r13-2540

2024-06-18 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #7 from Patrick Palka  ---
Non-constexpr testcase exhibiting an even older regression (since
r8-2720-gf44a8dd56f5bfb):

template 
void f(int (&)[N]);

template 
struct A {
  static int STR[];
  A() { [](auto){ f(STR); }; }
};

template
int A::STR[] = {1,2,3};

A a;

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function use of static constexpr array type whos initializer defines the size since r13-2540

2024-06-17 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

Jakub Jelinek  changed:

   What|Removed |Added

   Keywords|needs-bisection |
Summary|[13/14/15 Regression]   |[13/14/15 Regression]
   |template argument   |template argument
   |deduction/substitution  |deduction/substitution
   |failed in generic lambda|failed in generic lambda
   |function use of static  |function use of static
   |constexpr array type whos   |constexpr array type whos
   |initializer defines the |initializer defines the
   |size|size since r13-2540
 CC||jakub at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Started with r13-2540-g4db3cb781c355341fa041e6b5bbbfc495c6a0fdb

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function use of static constexpr array type whos initializer defines the size

2024-06-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function

2024-06-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

--- Comment #5 from Andrew Pinski  ---
Note this is not related to NSDMI nor related to use of STR in a non-complete
type context as shown by:
```
template 
void foo(const int (&data)[N]) {}

template 
struct Bar
{
static constexpr int STR[] = {1,2,3};
Bar();
};

template
Bar::Bar()
{
[](auto){
foo(STR);
   };
}

int main()
{
Bar{};
}
```

[Bug c++/115358] [13/14/15 Regression] template argument deduction/substitution failed in generic lambda function

2024-06-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115358

Andrew Pinski  changed:

   What|Removed |Added

Summary|template argument   |[13/14/15 Regression]
   |deduction/substitution  |template argument
   |failed in generic lambda|deduction/substitution
   |function|failed in generic lambda
   ||function
   Last reconfirmed||2024-06-05
   Keywords||needs-bisection,
   ||rejects-valid
 Ever confirmed|0   |1
   Target Milestone|--- |13.4
 Status|UNCONFIRMED |NEW

--- Comment #4 from Andrew Pinski  ---
Confirmed.