public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression
@ 2021-07-29 20:38 mu11 at yahoo dot com
  2021-07-29 20:44 ` [Bug c++/101680] [9/10 Regression] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mu11 at yahoo dot com @ 2021-07-29 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101680
           Summary: spurious error: use of ‘this’ in a constant expression
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mu11 at yahoo dot com
  Target Milestone: ---

g++ issues a spurious error for the following test case:

$ cat t.cpp
template<auto & TASK, int, typename... ARGS> auto f1(ARGS &&...);

template<class T, int>
struct F { };

template<class T, class C>
struct K { };

template<typename T>
struct N {
  using i = typename T::i;
  struct M { };
  static void S(typename F<K<M, i>, 1>::template A<2> m) { }
  void f2() {
#ifdef BUG
    f1<N<T>::S, int>(this->t);
#else
    f1<S, int>(this->t);
#endif
  }
};

% g++ -c -std=c++17 t.cpp
% 

% g++ -c -DBUG -std=c++17 t.cpp
t.cpp: In member function ‘void N<T>::f2()’:
t.cpp:16:14: error: use of ‘this’ in a constant expression
   16 |     f1<N<T>::S, int>(this->t);
      |              ^

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

* [Bug c++/101680] [9/10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
@ 2021-07-29 20:44 ` pinskia at gcc dot gnu.org
  2021-07-30  6:14 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-29 20:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|spurious error: use of      |[9/10 Regression] spurious
                   |‘this’ in a constant        |error: use of ‘this’ in a
                   |expression                  |constant expression
      Known to work|                            |8.5.0
           Keywords|                            |rejects-valid
      Known to fail|                            |10.1.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems fixed in GCC 11.
But fails in 10.3.0 and was working in GCC 8.5.0.

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

* [Bug c++/101680] [9/10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
  2021-07-29 20:44 ` [Bug c++/101680] [9/10 Regression] " pinskia at gcc dot gnu.org
@ 2021-07-30  6:14 ` rguenth at gcc dot gnu.org
  2021-11-10 14:37 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-30  6:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-30
   Target Milestone|---                         |10.4
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
           Priority|P3                          |P2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thus confirmed.

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

* [Bug c++/101680] [9/10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
  2021-07-29 20:44 ` [Bug c++/101680] [9/10 Regression] " pinskia at gcc dot gnu.org
  2021-07-30  6:14 ` rguenth at gcc dot gnu.org
@ 2021-11-10 14:37 ` marxin at gcc dot gnu.org
  2022-06-28 10:45 ` [Bug c++/101680] [10 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-10 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with r11-6878-ga8cef3cba6945730 and the regression was
introduced in r9-5972-g10839133ce6c196c.

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

* [Bug c++/101680] [10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
                   ` (2 preceding siblings ...)
  2021-11-10 14:37 ` marxin at gcc dot gnu.org
@ 2022-06-28 10:45 ` jakub at gcc dot gnu.org
  2023-07-07  9:08 ` rguenth at gcc dot gnu.org
  2023-07-07  9:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/101680] [10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
                   ` (3 preceding siblings ...)
  2022-06-28 10:45 ` [Bug c++/101680] [10 " jakub at gcc dot gnu.org
@ 2023-07-07  9:08 ` rguenth at gcc dot gnu.org
  2023-07-07  9:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101680
Bug 101680 depends on bug 97399, which changed state.

Bug 97399 Summary: [10 Regression] g++ 9.3 cannot compile SFINAE code with separated declaration and definition, g++ 7.3 compiles
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97399

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

* [Bug c++/101680] [10 Regression] spurious error: use of ‘this’ in a constant expression
  2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
                   ` (4 preceding siblings ...)
  2023-07-07  9:08 ` rguenth at gcc dot gnu.org
@ 2023-07-07  9:44 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|10.5                        |11.0
             Status|NEW                         |RESOLVED
      Known to fail|                            |10.5.0

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 20:38 [Bug c++/101680] New: spurious error: use of ‘this’ in a constant expression mu11 at yahoo dot com
2021-07-29 20:44 ` [Bug c++/101680] [9/10 Regression] " pinskia at gcc dot gnu.org
2021-07-30  6:14 ` rguenth at gcc dot gnu.org
2021-11-10 14:37 ` marxin at gcc dot gnu.org
2022-06-28 10:45 ` [Bug c++/101680] [10 " jakub at gcc dot gnu.org
2023-07-07  9:08 ` rguenth at gcc dot gnu.org
2023-07-07  9:44 ` 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).