public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code
@ 2015-07-12 22:26 ppalka at gcc dot gnu.org
  2015-07-12 22:27 ` [Bug c++/66850] " ppalka at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-12 22:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 66850
           Summary: Adding a forward declaration of a template containing
                    a template template parm causes ICE on valid code
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

The following snippet emits an ICE in tsubst:

template <template <typename U, U> class> struct Sort;

template <template <typename U, U> class Comparator>
struct Sort
{
  template <int I>
  struct less_than
  {
    Comparator<int, I> a;
  };
};

If one removes the initial forward declaration of "struct Sort" then the code
compiles fine.

Branched off from PR65186.


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

* [Bug c++/66850] Adding a forward declaration of a template containing a template template parm causes ICE on valid code
  2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
@ 2015-07-12 22:27 ` ppalka at gcc dot gnu.org
  2015-07-12 23:26 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-12 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
I think I have a fix for this.


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

* [Bug c++/66850] Adding a forward declaration of a template containing a template template parm causes ICE on valid code
  2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
  2015-07-12 22:27 ` [Bug c++/66850] " ppalka at gcc dot gnu.org
@ 2015-07-12 23:26 ` ppalka at gcc dot gnu.org
  2015-07-15  0:01 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-12 23:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Related test cases:

template <typename T, template <typename U, U> class> struct Sort;

template <template <typename U, U> class Comparator>
struct Sort<int, Comparator>
{
  template <int I>
  struct less_than
  {
    Comparator<int, I> a;
  };
};


========== 

template <typename C, C> struct integral_constant {};

template <typename T, template <typename U, U> class> struct Sort;  

template <template <typename U, U> class Comparator>  
struct Sort<int, Comparator>
{  
    template <int I> struct less_than:
        integral_constant<bool, Comparator<int, I>::value> {};
};


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

* [Bug c++/66850] Adding a forward declaration of a template containing a template template parm causes ICE on valid code
  2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
  2015-07-12 22:27 ` [Bug c++/66850] " ppalka at gcc dot gnu.org
  2015-07-12 23:26 ` ppalka at gcc dot gnu.org
@ 2015-07-15  0:01 ` ppalka at gcc dot gnu.org
  2015-07-15  2:43 ` ppalka at gcc dot gnu.org
  2015-07-15  2:43 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-15  0:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Author: ppalka
Date: Wed Jul 15 00:01:21 2015
New Revision: 225801

URL: https://gcc.gnu.org/viewcvs?rev=225801&root=gcc&view=rev
Log:
Fix PR c++/66850

gcc/cp/ChangeLog:

        PR c++/66850
        * pt.c (redeclare_class_template): Set the DECL_CONTEXTs of each
        template template parm in the redeclaration.
        (lookup_template_class_1): Peel off irrelevant template levels
        from current_template_parms before augmenting the argument
        list.

gcc/testsuite/ChangeLog:

        PR c++/66850
        * g++.dg/template/pr66850.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/template/pr66850.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/66850] Adding a forward declaration of a template containing a template template parm causes ICE on valid code
  2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-07-15  0:01 ` ppalka at gcc dot gnu.org
@ 2015-07-15  2:43 ` ppalka at gcc dot gnu.org
  2015-07-15  2:43 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-15  2:43 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.


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

* [Bug c++/66850] Adding a forward declaration of a template containing a template template parm causes ICE on valid code
  2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-07-15  2:43 ` ppalka at gcc dot gnu.org
@ 2015-07-15  2:43 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-07-15  2:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-07-15  2:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-12 22:26 [Bug c++/66850] New: Adding a forward declaration of a template containing a template template parm causes ICE on valid code ppalka at gcc dot gnu.org
2015-07-12 22:27 ` [Bug c++/66850] " ppalka at gcc dot gnu.org
2015-07-12 23:26 ` ppalka at gcc dot gnu.org
2015-07-15  0:01 ` ppalka at gcc dot gnu.org
2015-07-15  2:43 ` ppalka at gcc dot gnu.org
2015-07-15  2:43 ` ppalka 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).