public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97399] New: g++ 9.3 cannot compile SFINAE code with separated declaration and definition, g++ 7.3 compiles
@ 2020-10-13  9:58 renlin at gcc dot gnu.org
  2020-10-13  9:58 ` [Bug c++/97399] " renlin at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: renlin at gcc dot gnu.org @ 2020-10-13  9:58 UTC (permalink / raw)
  To: gcc-bugs

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.

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

end of thread, other threads:[~2023-07-07  9:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13  9:58 [Bug c++/97399] New: g++ 9.3 cannot compile SFINAE code with separated declaration and definition, g++ 7.3 compiles renlin at gcc dot gnu.org
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

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).