[Bug c++/66968] Incorrect template argument shown in diagnostic

2023-02-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

--- Comment #10 from Ivan Sorokin  ---
One more case (from 108676):

template 
struct X
{};

template 
X f();

template 
X g();

int main()
{
g();
}

Here 'X' is printed in the error message instead of 'X'.

[Bug c++/66968] Incorrect template argument shown in diagnostic

2023-02-06 Thread vanyacpp at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

Ivan Sorokin  changed:

   What|Removed |Added

 CC||vanyacpp at gmail dot com

--- Comment #9 from Ivan Sorokin  ---
*** Bug 108676 has been marked as a duplicate of this bug. ***

[Bug c++/66968] Incorrect template argument shown in diagnostic

2022-07-13 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

--- Comment #8 from Jonathan Wakely  ---
Here's another case, using the code from PR 106281:

template
class C
{
public:
  C() = default;

  template
C(AA, BB)
{ }

  C(C&&) = default;

private:
  struct __secret_tag  { };
  template
C(AA&, BB&, __secret_tag)
{ }
};

C c({}, {});


Among the overload resolution candidates we get:

cons.C:8:5: note: candidate: ‘template C::C(AA, BB)
[with BB = AA; A = int; B = int]’


Where does "with BB = AA" come from?!

[Bug c++/66968] Incorrect template argument shown in diagnostic

2021-07-16 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

--- Comment #7 from Jonathan Wakely  ---
To reproduce the std::tuple error above, use this code at r12-2379

#include 
std::tuple t;
auto a = std::get<1>(t);

[Bug c++/66968] Incorrect template argument shown in diagnostic

2021-07-16 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:3dbc7b809a62167b36f217ab5f43207be19e5908

commit r12-2379-g3dbc7b809a62167b36f217ab5f43207be19e5908
Author: Jonathan Wakely 
Date:   Fri Jul 16 20:59:43 2021 +0100

libstdc++: Improve diagnostics for std::get with invalid tuple index

This adds a deleted overload of std::get(const tuple&).
Invalid calls with an out of range index will match the deleted overload
and give a single, clear error about calling a deleted function, instead
of overload resolution errors for every std::get overload in the
library.

This changes the current output of 15+ errors (plus notes and associated
header context) into just two errors (plus context):

error: static assertion failed: tuple index must be in range
error: use of deleted function 'constexpr std::__enable_if_t<(__i >=
sizeof... (_Types))> std::get(const std::tuple<_Types ...>&) [with long
unsigned int __i = 1; _Elements = {int}; std::__enable_if_t<(__i >= sizeof...
(_Types))> = void]'

This seems like a nice improvement, although PR c++/66968 means that
"_Types" is printed in the signature rather than "_Elements".

Signed-off-by: Jonathan Wakely 

libstdc++-v3/ChangeLog:

* include/std/tuple (get): Add deleted overload for bad
index.
* testsuite/20_util/tuple/element_access/get_neg.cc: Adjust
expected errors.

[Bug c++/66968] Incorrect template argument shown in diagnostic

2021-07-16 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed|2017-08-21 00:00:00 |2021-7-16

--- Comment #5 from Jonathan Wakely  ---
Seen with std::tuple and std::get too:

t2.C:38:16: error: use of deleted function 'typename enable_if<(i >= sizeof...
(Elements))>::type get(const tuple&) [with long unsigned int i =
1; Elements = {int}; typename enable_if<(i >= sizeof... (Elements))>::type =
void]'

It should be _Elements, but it shows _Types.

[Bug c++/66968] Incorrect template argument shown in diagnostic

2018-09-04 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

Eric Gallager  changed:

   What|Removed |Added

 CC||dmalcolm at gcc dot gnu.org,
   ||dodji at gcc dot gnu.org

--- Comment #4 from Eric Gallager  ---
cc-ing diagnostics maintainers

[Bug c++/66968] Incorrect template argument shown in diagnostic

2017-08-21 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

Eric Gallager  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-21
 CC||egallager at gcc dot gnu.org
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=99
 Ever confirmed|0   |1

--- Comment #3 from Eric Gallager  ---
Confirming as a separate bug from bug 99, but still adding it to "See Also"
though.

[Bug c++/66968] Incorrect template argument shown in diagnostic

2015-07-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

--- Comment #2 from Jonathan Wakely redi at gcc dot gnu.org ---
Yes maybe a dup of PR99 but it looks like all the examples in that bug involve
an overload and using the parameter names from the wrong overload. Here it uses
the parameter from a function that never participates in overload resolution.


[Bug c++/66968] Incorrect template argument shown in diagnostic

2015-07-25 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66968

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #1 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
A dup of PR99 ?