public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99610] New: GCC thinks member function template is a deduction guide
@ 2021-03-16  0:57 gcchelp.5.adept at 0sg dot net
  2021-03-16  0:59 ` [Bug c++/99610] " gcchelp.5.adept at 0sg dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gcchelp.5.adept at 0sg dot net @ 2021-03-16  0:57 UTC (permalink / raw)
  To: 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<K, V, C>' must have trailing return type
[1] note: 'template<class K, class V, class C> 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<K> >
    class Hash 
    {
        // ...
    };


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/99610] GCC thinks member function template is a deduction guide
  2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
@ 2021-03-16  0:59 ` gcchelp.5.adept at 0sg dot net
  2021-03-16  1:02 ` gcchelp.5.adept at 0sg dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gcchelp.5.adept at 0sg dot net @ 2021-03-16  0:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

--- Comment #1 from Christian Schüler <gcchelp.5.adept at 0sg dot net> ---
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
         { ... }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/99610] GCC thinks member function template is a deduction guide
  2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
  2021-03-16  0:59 ` [Bug c++/99610] " gcchelp.5.adept at 0sg dot net
@ 2021-03-16  1:02 ` gcchelp.5.adept at 0sg dot net
  2021-03-16  8:20 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gcchelp.5.adept at 0sg dot net @ 2021-03-16  1:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

--- Comment #2 from Christian Schüler <gcchelp.5.adept at 0sg dot net> ---
gcc version 8.4.0 (Ubuntu 8.4.0-1ubuntu1~18.04)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/99610] GCC thinks member function template is a deduction guide
  2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
  2021-03-16  0:59 ` [Bug c++/99610] " gcchelp.5.adept at 0sg dot net
  2021-03-16  1:02 ` gcchelp.5.adept at 0sg dot net
@ 2021-03-16  8:20 ` rguenth at gcc dot gnu.org
  2021-03-16 21:06 ` jakub at gcc dot gnu.org
  2021-03-16 21:07 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-16  8:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2021-03-16
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
> clang++-9 -S t.C
t.C:1:48: error: no template named 'HashContext'
template< typename K, typename V, typename C = HashContext<K> >
                                               ^
t.C:14:15: error: expected expression
            { ... }
              ^

can you provide a complete testcase?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/99610] GCC thinks member function template is a deduction guide
  2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
                   ` (2 preceding siblings ...)
  2021-03-16  8:20 ` rguenth at gcc dot gnu.org
@ 2021-03-16 21:06 ` jakub at gcc dot gnu.org
  2021-03-16 21:07 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-16 21:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Without a full testcase hard to say, but perhaps dup of PR97663?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/99610] GCC thinks member function template is a deduction guide
  2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
                   ` (3 preceding siblings ...)
  2021-03-16 21:06 ` jakub at gcc dot gnu.org
@ 2021-03-16 21:07 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-16 21:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99610

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And if that is the case, there is also easy workaround, just use unsigned int
Hash instead of unsigned Hash.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-16 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  0:57 [Bug c++/99610] New: GCC thinks member function template is a deduction guide gcchelp.5.adept at 0sg dot net
2021-03-16  0:59 ` [Bug c++/99610] " gcchelp.5.adept at 0sg dot net
2021-03-16  1:02 ` gcchelp.5.adept at 0sg dot net
2021-03-16  8:20 ` rguenth at gcc dot gnu.org
2021-03-16 21:06 ` jakub at gcc dot gnu.org
2021-03-16 21:07 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).