public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42466]  New: Multiple instantiations of template constructor fail
@ 2009-12-22 18:05 apatterno at gmail dot com
  2009-12-22 18:22 ` [Bug c++/42466] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: apatterno at gmail dot com @ 2009-12-22 18:05 UTC (permalink / raw)
  To: gcc-bugs

The test code:

template<class IntT, IntT X>
struct A
{
    IntT val_;

    A() : val_(X) {}
    A(IntT arg) : val_(arg) {}

    template<IntT X2>
    A(const A<IntT, X2>& other) : val_(other.val_) {}
};

int main(int argc, char** argv)
{
    A<int, 42> a;
    A<int, 100> b = a;

    A<unsigned, 42u> c;
    A<unsigned, 100u> d = c;

    A<long, 42l> e;
    A<long, 100l> f = e;
}

fails to compile on gcc 4.3.2:

case.cpp: In function 'int main(int, char**)':
case.cpp:19: error: conversion from 'A<unsigned int, 42u>' to non-scalar type
'A<unsigned int, 100u>' requested
case.cpp:22: error: conversion from 'A<long int, 42l>' to non-scalar type
'A<long int, 100l>' requested

The first conversion is OK, but the other two conversions are being flagged as
errors.  Even if I were to put the conversions in a different order, the same
results... first one is OK, other two fail.


-- 
           Summary: Multiple instantiations of template constructor fail
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: apatterno at gmail dot com
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


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


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

* [Bug c++/42466] Multiple instantiations of template constructor fail
  2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
@ 2009-12-22 18:22 ` pinskia at gcc dot gnu dot org
  2009-12-22 18:29 ` paolo dot carlini at oracle dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-12-22 18:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-12-22 18:21 -------
Confirmed, not a regression as far as I can tell either.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.3 4.0.1 4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-22 18:21:54
               date|                            |


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


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

* [Bug c++/42466] Multiple instantiations of template constructor fail
  2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
  2009-12-22 18:22 ` [Bug c++/42466] " pinskia at gcc dot gnu dot org
@ 2009-12-22 18:29 ` paolo dot carlini at oracle dot com
  2009-12-22 19:21 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-22 18:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-12-22 18:29 -------
Maybe Jason is willing to have a look. If it's legal, and I think it is, it's a
pity that g++ users can't write this type of nifty constructor.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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


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

* [Bug c++/42466] Multiple instantiations of template constructor fail
  2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
  2009-12-22 18:22 ` [Bug c++/42466] " pinskia at gcc dot gnu dot org
  2009-12-22 18:29 ` paolo dot carlini at oracle dot com
@ 2009-12-22 19:21 ` jason at gcc dot gnu dot org
  2009-12-22 23:17 ` jason at gcc dot gnu dot org
  2009-12-31 15:48 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-22 19:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-12-22 18:21:54         |2009-12-22 19:21:35
               date|                            |


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


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

* [Bug c++/42466] Multiple instantiations of template constructor fail
  2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
                   ` (2 preceding siblings ...)
  2009-12-22 19:21 ` jason at gcc dot gnu dot org
@ 2009-12-22 23:17 ` jason at gcc dot gnu dot org
  2009-12-31 15:48 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-22 23:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jason at gcc dot gnu dot org  2009-12-22 23:17 -------
Subject: Bug 42466

Author: jason
Date: Tue Dec 22 23:16:46 2009
New Revision: 155411

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155411
Log:
        PR c++/42466
        * pt.c (reduce_template_parm_level): Check the type before
        returning cached TEMPLATE_PARM_INDEX.

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


-- 


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


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

* [Bug c++/42466] Multiple instantiations of template constructor fail
  2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
                   ` (3 preceding siblings ...)
  2009-12-22 23:17 ` jason at gcc dot gnu dot org
@ 2009-12-31 15:48 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-12-31 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-12-31 15:48 -------
Looks like this was fixed for 4.5.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|3.3 4.0.1 4.5.0             |3.3 4.0.1
      Known to work|                            |4.5.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2009-12-31 15:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-22 18:05 [Bug c++/42466] New: Multiple instantiations of template constructor fail apatterno at gmail dot com
2009-12-22 18:22 ` [Bug c++/42466] " pinskia at gcc dot gnu dot org
2009-12-22 18:29 ` paolo dot carlini at oracle dot com
2009-12-22 19:21 ` jason at gcc dot gnu dot org
2009-12-22 23:17 ` jason at gcc dot gnu dot org
2009-12-31 15:48 ` rguenth at gcc dot gnu dot 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).