public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "renlin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97399] New: g++ 9.3 cannot compile SFINAE code with separated declaration and definition, g++ 7.3 compiles
Date: Tue, 13 Oct 2020 09:58:14 +0000	[thread overview]
Message-ID: <bug-97399-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97399
           Summary: g++ 9.3 cannot compile SFINAE code with separated
                    declaration and definition, g++ 7.3 compiles
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: renlin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 49362
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49362&action=edit
test case 1

For gcc_1.c++
gcc 7.3 compiles for this code
clang 7 compiles for this code
gcc 9.3 fails to compile with following message

Not sure if this is gcc's issue or clang.

```
<source>:29:16: error: no declaration matches 'constexpr
enable_if_t<((tmp*)this)->is_integral<E>(), bool> tmp::func(E, E) const'

   29 | constexpr auto tmp::func(E f_lhs, E f_rhs)

      |                ^~~

<source>:18:27: note: candidate is: 'template<class E> static constexpr
enable_if_t<((tmp*)this)->is_integral<E>(), bool> tmp::func(E, E)'

   18 |     static constexpr auto func(E f_lhs, E f_rhs)

      |                           ^~~~

<source>:12:8: note: 'struct tmp' defined here

   12 | struct tmp
```

Meanwhile for gcc_2.c++
gcc compiles without any issue.
clang gives the following error message
```
<source>:27:28: error: template parameter redefines default argument

template <class E, class = enable_if_t<tmp::is_integral<E>(), bool>>

                           ^

<source>:17:32: note: previous default template argument defined here

    template <class E, class = enable_if_t<tmp::is_integral<E>(), bool>>
```
It seems this is not an new issue, and might be duplicated.

             reply	other threads:[~2020-10-13  9:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13  9:58 renlin at gcc dot gnu.org [this message]
2020-10-13  9:58 ` [Bug c++/97399] " renlin at gcc dot gnu.org
2020-10-13 11:02 ` [Bug c++/97399] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2020-10-13 14:10 ` marxin at gcc dot gnu.org
2021-01-14  9:25 ` rguenth at gcc dot gnu.org
2021-01-20 20:00 ` ppalka at gcc dot gnu.org
2021-01-23  5:25 ` cvs-commit at gcc dot gnu.org
2021-01-23  5:25 ` [Bug c++/97399] [9/10 " ppalka at gcc dot gnu.org
2021-04-10 20:33 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2022-05-27  9:43 ` [Bug c++/97399] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07  9:08 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97399-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).