public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97279] New: GCC ignores the operation definition of the template
@ 2020-10-03 12:13 tangyixuan at mail dot dlut.edu.cn
  2020-10-05 16:47 ` [Bug c++/97279] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tangyixuan at mail dot dlut.edu.cn @ 2020-10-03 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97279
           Summary: GCC ignores the operation definition of the template
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, gcc selects the overloaded definition operation+() although it is not
declared before.

$ cat s.cpp

#include <iostream>
struct S {
    template <typename T>
    void operator+(T) { std::cout << "1" <<"\n"; }
};
namespace N {
    template <typename T>
    void func(const T value1) { S s; s +(value1); }
}

struct S1 {};
namespace N {
    void operator+(S&, S1) { std::cout << "2" <<"\n"; }
}

int main(int, char**)
{
    S1 s1;
    N::func(s1);
}

$ g++ s.cpp
$ ./a.out
2

$ clang++ s.cpp
$ ./a.out
1

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
@ 2020-10-05 16:47 ` mpolacek at gcc dot gnu.org
  2020-10-05 23:08 ` harald at gigawatt dot nl
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-05 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Hmm, ICC also produces 2.  Not quite sure what's going on here.

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
  2020-10-05 16:47 ` [Bug c++/97279] " mpolacek at gcc dot gnu.org
@ 2020-10-05 23:08 ` harald at gigawatt dot nl
  2020-10-07 16:15 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: harald at gigawatt dot nl @ 2020-10-05 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

Harald van Dijk <harald at gigawatt dot nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |harald at gigawatt dot nl

--- Comment #2 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Marek Polacek from comment #1)
> Hmm, ICC also produces 2.  Not quite sure what's going on here.

ICC produces 2 by default, but produces 1 when the -strict-ansi command line
option is used.

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
  2020-10-05 16:47 ` [Bug c++/97279] " mpolacek at gcc dot gnu.org
  2020-10-05 23:08 ` harald at gigawatt dot nl
@ 2020-10-07 16:15 ` mpolacek at gcc dot gnu.org
  2021-08-04 17:42 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-07 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-10-07
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks Harald.

Confirmed then, I suppose.

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
                   ` (2 preceding siblings ...)
  2020-10-07 16:15 ` mpolacek at gcc dot gnu.org
@ 2021-08-04 17:42 ` pinskia at gcc dot gnu.org
  2021-12-08 14:32 ` marxin at gcc dot gnu.org
  2021-12-08 16:31 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.1.0
      Known to work|                            |12.0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems fixed on the trunk.

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
                   ` (3 preceding siblings ...)
  2021-08-04 17:42 ` pinskia at gcc dot gnu.org
@ 2021-12-08 14:32 ` marxin at gcc dot gnu.org
  2021-12-08 16:31 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-08 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
           Keywords|needs-bisection             |
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=51577

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed in r12-702-g6ab1176667734bd6.

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

* [Bug c++/97279] GCC ignores the operation definition of the template
  2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
                   ` (4 preceding siblings ...)
  2021-12-08 14:32 ` marxin at gcc dot gnu.org
@ 2021-12-08 16:31 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-08 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.0

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed. g++.dg/lookup/operator-3.C covers this issue.

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

end of thread, other threads:[~2021-12-08 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03 12:13 [Bug c++/97279] New: GCC ignores the operation definition of the template tangyixuan at mail dot dlut.edu.cn
2020-10-05 16:47 ` [Bug c++/97279] " mpolacek at gcc dot gnu.org
2020-10-05 23:08 ` harald at gigawatt dot nl
2020-10-07 16:15 ` mpolacek at gcc dot gnu.org
2021-08-04 17:42 ` pinskia at gcc dot gnu.org
2021-12-08 14:32 ` marxin at gcc dot gnu.org
2021-12-08 16:31 ` pinskia 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).