[Bug c++/99610] New: GCC thinks member function template is a deduction guide

2021-03-15 Thread gcchelp.5.adept at 0sg dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

Bug ID: 99610
   Summary: GCC thinks member function template is a deduction
guide
   Product: gcc
   Version: 8.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: gcchelp.5.adept at 0sg dot net
  Target Milestone: ---

When compiling with -std=c++17 or -std=gnu++17,
the following errors are reported for the code below:

[2] error: return type specified for deduction guide
[2] error: decl-specifier in declaration of deduction guide
[2] error: 'signed' or 'unsigned' invalid for '__dguide_Hash'
[2] error: deduction guide for 'Hash' must have trailing return type
[1] note: 'template class Hash' declared here

The same code is accepted without errors by clang and msvc 2019.
I'm not sufficiently versed in the c++ standard to tell if this is on the
compiler or not.

Thanks!


-- 

[1] template< typename K, typename V, typename C = HashContext >
class Hash 
{
// ...
};


template< typename K >
class HashContext
{
public:
template< typename X >
[2] unsigned Hash( const X &arg ) const
{ ... }
};

[Bug c++/99610] GCC thinks member function template is a deduction guide

2021-03-15 Thread gcchelp.5.adept at 0sg dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

--- Comment #1 from Christian Schüler  ---
There is a workaround
declaring the function Hash with trailing return will make the error go away.

template< typename X >
auto Hash( const X &arg ) const -> unsigned
 { ... }

[Bug c++/99610] GCC thinks member function template is a deduction guide

2021-03-15 Thread gcchelp.5.adept at 0sg dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

--- Comment #2 from Christian Schüler  ---
gcc version 8.4.0 (Ubuntu 8.4.0-1ubuntu1~18.04)