[Bug c++/27640] [4.2 Regression] segfault, related to constructor instantiation and virtual base case and templates and new operator

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu May 18 04:25:00 GMT 2006



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-05-18 04:25 -------
Confirmed, reduced testcase:
template < class T > struct refcounted : 
virtual T
{
    template < class A1 > refcounted (const A1 & a1) : T () { }
};
struct nfsserv {};
template < class T >
void
sfsserver_cache_alloc (int *ns)
{
    new refcounted < nfsserv > (*ns);
}
void
usage ()
{
    sfsserver_cache_alloc < int > ( 0);
}

if we change sfsserver_cache_alloc to be a non template it works.
If we change the new ... to a local variable it works.
if we change the argument type of sfsserver_cache_alloc to nfsserv, we get a
secondary bogus error message:
t.cc: In constructor 'refcounted<T>::refcounted(const A1&) [with A1 = nfsserv,
T = nfsserv]':
t.cc:11:   instantiated from 'void sfsserver_cache_alloc(nfsserv*) [with T =
int]'
t.cc:16:   instantiated from here
t.cc:4: error: could not convert 'a1' to 'bool'


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|i486-linux-gnu              |
   GCC host triplet|i486-linux-gnu              |
 GCC target triplet|i486-linux-gnu              |
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.2.0
      Known to work|                            |4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-18 04:25:04
               date|                            |
            Summary|segfault, related to        |[4.2 Regression] segfault,
                   |constructor instantiation   |related to constructor
                   |                            |instantiation and virtual
                   |                            |base case and templates and
                   |                            |new operator
   Target Milestone|---                         |4.2.0


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



More information about the Gcc-bugs mailing list