public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109551] New: Show location where implicit instantiation first required
@ 2023-04-19  8:33 redi at gcc dot gnu.org
  2023-04-19 17:59 ` [Bug c++/109551] " pinskia at gcc dot gnu.org
  2023-12-04 11:24 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-19  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109551
           Summary: Show location where implicit instantiation first
                    required
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Copied from https://github.com/llvm/llvm-project/issues/20129

template <class T> struct S1 {};
template <class T> struct S2: S1<T> {};
S2<int> s;
template <> struct S1<int> {};

We correctly reject this code:

src.cc:4:20: error: specialization of 'S1<int>' after instantiation
    4 | template <> struct S1<int> {};
      |                    ^~~~~~~
src.cc:4:20: error: redefinition of 'struct S1<int>'
src.cc:1:27: note: previous definition of 'struct S1<int>'
    1 | template <class T> struct S1 {};
      |                           ^~

But it would be nice if we also pointed to the location that required the
implicit instantiation, i.e. line 3:

src.cc:3:9: note: implicit instantiation first required here:
    3 | S2<int> s;
      |         ^


EDG does indicate where the implicit instantiation is, although it points to
the use of S1<T> as a base class of S2<int> on line 2 (maybe that's better?)

"src.cc", line 4: error: explicit specialization of class "S1<int>" must
          precede its first use (at line 2)
  template <> struct S1<int> {};
                     ^

1 error detected in the compilation of "src.cc".

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

* [Bug c++/109551] Show location where implicit instantiation first required
  2023-04-19  8:33 [Bug c++/109551] New: Show location where implicit instantiation first required redi at gcc dot gnu.org
@ 2023-04-19 17:59 ` pinskia at gcc dot gnu.org
  2023-12-04 11:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-19 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-04-19

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/109551] Show location where implicit instantiation first required
  2023-04-19  8:33 [Bug c++/109551] New: Show location where implicit instantiation first required redi at gcc dot gnu.org
  2023-04-19 17:59 ` [Bug c++/109551] " pinskia at gcc dot gnu.org
@ 2023-12-04 11:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-12-04 11:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eng.ahmad.nour at gmail dot com

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 112838 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-12-04 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19  8:33 [Bug c++/109551] New: Show location where implicit instantiation first required redi at gcc dot gnu.org
2023-04-19 17:59 ` [Bug c++/109551] " pinskia at gcc dot gnu.org
2023-12-04 11:24 ` redi 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).