[Bug c++/71527] wrong type mismatch while template argument deduction/substitution

2016-06-15 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71527

--- Comment #1 from Benjamin Buch  ---
I simplified the example code:

// Example ==
// A compile time int-type
template < int I >
struct size{};


// The problem:
template < typename T, int N >
void f(size< N >, T(&&)[N]){}


int main(){
// OK: T is int
f(size< 2 >(), {0, 1});

// Bug: wrong type mismatch, T should be float
f< float >(size< 2 >(), {0, 1});

// OK: error conflicting types
/* f(size< 2 >(), {0, 1.f}); */

// Bug: wrong type mismatch, T should be float
f< float >(size< 2 >(), {0, 1.f});
}
//===


~$ g++ -o main -std=c++14 main.cpp 
bug.cpp: In function ‘int main()’:
bug.cpp:16:32: error: no matching function for call to ‘f(size<2>,
)’
  f< float >(size< 2 >(), {0, 1});
^
bug.cpp:8:6: note: candidate: template void f(size, T
(&&)[N])
 void f(size< N >, T(&&)[N]){}
  ^
bug.cpp:8:6: note:   template argument deduction/substitution failed:
bug.cpp:16:32: note:   mismatched types ‘float’ and ‘int’
  f< float >(size< 2 >(), {0, 1});  
^
bug.cpp:22:34: error: no matching function for call to ‘f(size<2>,
)’
  f< float >(size< 2 >(), {0, 1.f});
  ^
bug.cpp:8:6: note: candidate: template void f(size, T
(&&)[N])
 void f(size< N >, T(&&)[N]){}  
  ^
bug.cpp:8:6: note:   template argument deduction/substitution failed:
bug.cpp:22:34: note:   mismatched types ‘float’ and ‘int’
  f< float >(size< 2 >(), {0, 1.f});
  ^

[Bug c++/71527] wrong type mismatch while template argument deduction/substitution

2017-08-18 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71527

Benjamin Buch  changed:

   What|Removed |Added

 CC||benni.buch at gmail dot com

--- Comment #2 from Benjamin Buch  ---
Bug does still exist in:

$ g++ --version
g++ (GCC) 8.0.0 20170818 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/71527] wrong type mismatch while template argument deduction/substitution

2021-12-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71527

Andrew Pinski  changed:

   What|Removed |Added

  Known to work||10.1.0, 9.1.0
  Known to fail||8.5.0
   Keywords||needs-bisection,
   ||rejects-valid

--- Comment #3 from Andrew Pinski  ---
Looks fixed in GCC 9.

[Bug c++/71527] wrong type mismatch while template argument deduction/substitution

2021-12-09 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71527

Martin Liška  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 CC||marxin at gcc dot gnu.org
 Status|UNCONFIRMED |RESOLVED

--- Comment #4 from Martin Liška  ---
Fixed with r9-1028-ge58c9d921da42371.

[Bug c++/71527] wrong type mismatch while template argument deduction/substitution

2021-12-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71527

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |9.0