public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/71982] Wrong error and note range with macro
       [not found] <bug-71982-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-02  3:28 ` pinskia at gcc dot gnu.org
  2021-12-09  8:59 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems fixed in GCC 11+.

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

* [Bug c++/71982] Wrong error and note range with macro
       [not found] <bug-71982-4@http.gcc.gnu.org/bugzilla/>
  2021-08-02  3:28 ` [Bug c++/71982] Wrong error and note range with macro pinskia at gcc dot gnu.org
@ 2021-12-09  8:59 ` marxin at gcc dot gnu.org
  2021-12-09 17:07 ` pinskia at gcc dot gnu.org
  2021-12-10  0:40 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09  8:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-09

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Seems fixed in GCC 11+.

Are you sure, do you any special -std option or so?

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

* [Bug c++/71982] Wrong error and note range with macro
       [not found] <bug-71982-4@http.gcc.gnu.org/bugzilla/>
  2021-08-02  3:28 ` [Bug c++/71982] Wrong error and note range with macro pinskia at gcc dot gnu.org
  2021-12-09  8:59 ` marxin at gcc dot gnu.org
@ 2021-12-09 17:07 ` pinskia at gcc dot gnu.org
  2021-12-10  0:40 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09 17:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

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

* [Bug c++/71982] Wrong error and note range with macro
       [not found] <bug-71982-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-12-09 17:07 ` pinskia at gcc dot gnu.org
@ 2021-12-10  0:40 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10  0:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Trunk gives:
[apinski@xeond2 src]$ ~/upstream-gcc/bin/gcc t.cc
t.cc: In instantiation of ‘bool operator==(const A<T>&, const A<T>&) [with T =
const B]’:
t.cc:25:30:   required from here
t.cc:1:34: error: no match for ‘operator==’ (operand types are ‘const B’ and
‘const B’)
    1 | #define MACRO(left, right) *left == *right
      |                                  ^
t.cc:15:10: note: in expansion of macro ‘MACRO’
   15 |   return MACRO(_left, _right);
      |          ^~~~~
t.cc:10:6: note: candidate: ‘template<class T> bool operator==(const A<T>&,
const A<T>&)’
   10 | bool operator==(const A<T>& left, const A<T>& right)
      |      ^~~~~~~~
t.cc:10:6: note:   template argument deduction/substitution failed:
t.cc:1:34: note:   ‘const B’ is not derived from ‘const A<T>’
    1 | #define MACRO(left, right) *left == *right
      |                                  ^
t.cc:15:10: note: in expansion of macro ‘MACRO’
   15 |   return MACRO(_left, _right);
      |          ^~~~~
t.cc:24:6: note: candidate: ‘bool operator==(C&, C&)’
   24 | bool operator==(C& left, C& right) {
      |      ^~~~~~~~
t.cc:24:20: note:   no known conversion for argument 1 from ‘const B’ to ‘C&’
   24 | bool operator==(C& left, C& right) {
      |                 ~~~^~~~


Which looks fine.
While GCC 10.1.0 gives:
t.cc: In instantiation of 'bool operator==(const A<T>&, const A<T>&) [with T =
const B]':
t.cc:25:30:   required from here
t.cc:1:34: error: no match for 'operator==' (operand types are 'const B' and
'const B')
    1 | #define MACRO(left, right) *left == *right
      |                            ~~~~~~^~~~~~~~~
    2 |
      |
    3 | template <typename T>
      | ~~~~~~~~~~~~~~~~~~~~~
    4 | struct A {
....

This is on the same machine. This happens on both aarch64 and x86_64.
The problem is not the code is being rejected (correctly) but the warning
location includes so much more than it should in previous versions of GCC.

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

end of thread, other threads:[~2021-12-10  0:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-71982-4@http.gcc.gnu.org/bugzilla/>
2021-08-02  3:28 ` [Bug c++/71982] Wrong error and note range with macro pinskia at gcc dot gnu.org
2021-12-09  8:59 ` marxin at gcc dot gnu.org
2021-12-09 17:07 ` pinskia at gcc dot gnu.org
2021-12-10  0:40 ` 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).