public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31584] [DR502] ICE on probably invalid code
       [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
@ 2011-05-05  1:08 ` redi at gcc dot gnu.org
  2011-05-05 17:51 ` [Bug c++/31584] [DR502] nested enum not considered dependent redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-05  1:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31584

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-05 00:47:58 UTC ---
unsuspending, DR 502 is part of the FDIS


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

* [Bug c++/31584] [DR502] nested enum not considered dependent
       [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
  2011-05-05  1:08 ` [Bug c++/31584] [DR502] ICE on probably invalid code redi at gcc dot gnu.org
@ 2011-05-05 17:51 ` redi at gcc dot gnu.org
  2021-08-04 21:41 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-05 17:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31584

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|[DR502] ICE on probably     |[DR502] nested enum not
                   |invalid code                |considered dependent
      Known to fail|                            |4.4.3, 4.5.2, 4.6.0

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-05 17:32:15 UTC ---
Summary changed, as there's no ICE now. This is 'accepts-invalid' because DR502
means C<T>::Inner is dependent, and [temp.class.spec]/8 says specialized
non-type arguments shall not have dependent types.


Reduced:

template <class T>
struct C
{
  enum Inner { c };

  template<Inner I, int dummy> struct Dispatcher;

  template<int dummy> struct Dispatcher<c, dummy> 
  { };

};

int main()
{
  C<double> Test;
}

expected error would be something like:

error: type 'C<T>::Inner' of template argument 'c' depends on a template
parameter


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

* [Bug c++/31584] [DR502] nested enum not considered dependent
       [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
  2011-05-05  1:08 ` [Bug c++/31584] [DR502] ICE on probably invalid code redi at gcc dot gnu.org
  2011-05-05 17:51 ` [Bug c++/31584] [DR502] nested enum not considered dependent redi at gcc dot gnu.org
@ 2021-08-04 21:41 ` pinskia at gcc dot gnu.org
  2023-06-04 23:25 ` richard-gccbugzilla at metafoo dot co.uk
  2023-06-05  8:53 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-04 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC, ICC, clang and MSVC all accept the testcase in comment #11.

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

* [Bug c++/31584] [DR502] nested enum not considered dependent
       [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-08-04 21:41 ` pinskia at gcc dot gnu.org
@ 2023-06-04 23:25 ` richard-gccbugzilla at metafoo dot co.uk
  2023-06-05  8:53 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2023-06-04 23:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Smith <richard-gccbugzilla at metafoo dot co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |richard-gccbugzilla@metafoo
                   |                            |.co.uk

--- Comment #13 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
(In reply to Andrew Pinski from comment #12)
> GCC, ICC, clang and MSVC all accept the testcase in comment #11.

I believe the testcase is valid. The instantiation of `C<double>` looks like
this:

struct C<double>
{
  enum Inner { c };

  template<Inner I, int dummy> struct Dispatcher;

  template<int dummy> struct Dispatcher<c, dummy> 
  { };

};

... and the template argument `c` here refers to the non-dependent enumeration
constant `C<double>::c`.

The rule governing whether the original template `C` is valid is
[temp.res.general]/6 (https://eel.is/c++draft/temp.res.general#6), and in
particular:

> no diagnostic shall be issued for a template for which a valid specialization can be generated

Because `C` has valid specializations, it's valid.

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

* [Bug c++/31584] [DR502] nested enum not considered dependent
       [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2023-06-04 23:25 ` richard-gccbugzilla at metafoo dot co.uk
@ 2023-06-05  8:53 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-05  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
So there's no bug now then. The error in comment 1 was probably fixed by:

commit g:dc28490d05f5ef25c5ff24ef946f48f402a20be8
Author: Jason Merrill
Date:   Tue Sep 4 13:27:21 2007

    re PR c++/14032 (Specialization of inner template using outer template
argument doesn't work)

            PR c++/14032
            * pt.c (most_specialized_class): Substitute outer template
            arguments into the arguments of a member template partial
            specialization.
            (strip_innermost_template_args): New fn.

    From-SVN: r128076

And so this was fixed for GCC 4.3.0

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

end of thread, other threads:[~2023-06-05  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-31584-4@http.gcc.gnu.org/bugzilla/>
2011-05-05  1:08 ` [Bug c++/31584] [DR502] ICE on probably invalid code redi at gcc dot gnu.org
2011-05-05 17:51 ` [Bug c++/31584] [DR502] nested enum not considered dependent redi at gcc dot gnu.org
2021-08-04 21:41 ` pinskia at gcc dot gnu.org
2023-06-04 23:25 ` richard-gccbugzilla at metafoo dot co.uk
2023-06-05  8:53 ` 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).