[Bug c++/99493] Address of template parameter object is not a valid template argument

2024-01-18 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

--- Comment #8 from Johel Ernesto Guerrero Peña  ---
Thank you!

[Bug c++/99493] Address of template parameter object is not a valid template argument

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

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
   Target Milestone|--- |13.3
 Resolution|--- |FIXED
 CC||ppalka at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

--- Comment #7 from Patrick Palka  ---
Fixed for GCC 13.3 / 14.

[Bug c++/99493] Address of template parameter object is not a valid template argument

2024-01-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

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

https://gcc.gnu.org/g:4ffb23975b32bfd285915c3d6659b837868b5aa9

commit r13-8235-g4ffb23975b32bfd285915c3d6659b837868b5aa9
Author: Patrick Palka 
Date:   Wed Jan 17 13:01:01 2024 -0500

c++: address of class NTTP object as targ [PR113242]

invalid_tparm_referent_p was rejecting using the address of a class NTTP
object as a template argument, but this should be fine.

PR c++/113242
PR c++/99493

gcc/cp/ChangeLog:

* pt.cc (invalid_tparm_referent_p) : Suppress
DECL_ARTIFICIAL rejection test for class NTTP objects.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class61.C: New test.
* g++.dg/cpp2a/nontype-class62.C: New test.

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

[Bug c++/99493] Address of template parameter object is not a valid template argument

2024-01-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

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

https://gcc.gnu.org/g:68cea2d32a9fd525154b6a48042e5835d4c5e371

commit r14-8189-g68cea2d32a9fd525154b6a48042e5835d4c5e371
Author: Patrick Palka 
Date:   Wed Jan 17 13:01:01 2024 -0500

c++: address of class NTTP object as targ [PR113242]

invalid_tparm_referent_p was rejecting using the address of a class NTTP
object as a template argument, but this should be fine.

PR c++/113242
PR c++/99493

gcc/cp/ChangeLog:

* pt.cc (invalid_tparm_referent_p) : Suppress
DECL_ARTIFICIAL rejection test for class NTTP objects.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-class61.C: New test.
* g++.dg/cpp2a/nontype-class62.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/99493] Address of template parameter object is not a valid template argument

2022-01-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2022-01-19

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

[Bug c++/99493] Address of template parameter object is not a valid template argument

2022-01-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

Andrew Pinski  changed:

   What|Removed |Added

URL|https://godbolt.org/z/9zYo8 |
   |f   |

--- Comment #3 from Andrew Pinski  ---
https://godbolt.org/z/9zYo8f

[Bug c++/99493] Address of template parameter object is not a valid template argument

2021-03-15 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

--- Comment #2 from Johel Ernesto Guerrero Peña  ---
Looks like you can get away by instead passing around a pointer to the address
of the template parameter object: https://godbolt.org/z/o3Paz1.
```C++
struct A{};
templateconstexpr const A*tpo{};
constexpr A ga{};
templaterequires(a==)struct B{};
[[maybe_unused]]B<>b;
```

[Bug c++/99493] Address of template parameter object is not a valid template argument

2021-03-14 Thread johelegp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99493

--- Comment #1 from Johel Ernesto Guerrero Peña  ---
Slightly simplified: https://godbolt.org/z/rv97Gh.
```C++
struct A{};
templateconstexpr const A*tpo{};
templatestruct B{};
B>b;
```
```
:4:10: error: the address of 'A{}' is not a valid template argument
4 | B>b;
  |  ^~
Compiler returned: 1
```