public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56886] New: [4.9 regression] undesirable instantiation of class template default argument
@ 2013-04-08 23:05 zeratul976 at hotmail dot com
  2013-04-09 10:02 ` [Bug c++/56886] " rguenth at gcc dot gnu.org
  2013-04-09 12:33 ` jason at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: zeratul976 at hotmail dot com @ 2013-04-08 23:05 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56886
           Summary: [4.9 regression] undesirable instantiation of class
                    template default argument
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zeratul976@hotmail.com


The following code compiles with GCC 4.8 and earlier:


template <typename T>
struct A
{
    typedef typename T::type type;
};

template <typename T, typename U = A<int>()>
struct C;

template <typename T>
struct C<T>
{

};

C<int> c;


but fails to compile with GCC 4.9 (2013-04-07 snapshot) with the following
error:

test.cpp: In instantiation of 'struct A<int>':
test.cpp:16:8:   required from here
test.cpp:4:30: error: 'int' is not a class, struct, or union type
     typedef typename T::type type;
                              ^


It seems that GCC 4.9 is instantiating A<int>, the return type of the function
type A<int>() which is the default argument for C's template parameter U, while
GCC 4.8 and earlier was not instantiating this class.

The error also has something to do with the presence of the partial
specialization of C, because removing it (and giving the primary template a
definition instead) makes it go away.


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

* [Bug c++/56886] [4.9 regression] undesirable instantiation of class template default argument
  2013-04-08 23:05 [Bug c++/56886] New: [4.9 regression] undesirable instantiation of class template default argument zeratul976 at hotmail dot com
@ 2013-04-09 10:02 ` rguenth at gcc dot gnu.org
  2013-04-09 12:33 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-09 10:02 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0


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

* [Bug c++/56886] [4.9 regression] undesirable instantiation of class template default argument
  2013-04-08 23:05 [Bug c++/56886] New: [4.9 regression] undesirable instantiation of class template default argument zeratul976 at hotmail dot com
  2013-04-09 10:02 ` [Bug c++/56886] " rguenth at gcc dot gnu.org
@ 2013-04-09 12:33 ` jason at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2013-04-09 12:33 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |DUPLICATE

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2013-04-09 12:32:58 UTC ---
Yes.

*** This bug has been marked as a duplicate of bug 56838 ***


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

end of thread, other threads:[~2013-04-09 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08 23:05 [Bug c++/56886] New: [4.9 regression] undesirable instantiation of class template default argument zeratul976 at hotmail dot com
2013-04-09 10:02 ` [Bug c++/56886] " rguenth at gcc dot gnu.org
2013-04-09 12:33 ` jason 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).