public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26029]  New: Member initialization by constructor parameter object method calls
@ 2006-01-30 13:01 Don at Skyler dot com
  2006-01-30 13:06 ` [Bug c++/26029] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Don at Skyler dot com @ 2006-01-30 13:01 UTC (permalink / raw)
  To: gcc-bugs

//      Expected output is:
//      i_=1

//      In g++ 3.4.4 under cygwin, output is
//      i_=
//      followed by a random integer value
//      (I've seen zero and 97).
//      It appears as though the i_ member is
//      not being initialized.

#include        <iostream>

struct  B1
{
        B1      (int      i  ): i_(i    ) { }
        B1      (const B1 &b1): i_(b1.i_) { }
        int i_;
};

struct  B2
{
        B2      (void)                    { }
};

struct  Initializer
{
        B1      b1(void)        const   {       return  B1(1);  }
        B2      b2(void)        const   {       return  B2( );  }
};

struct  D       :       public  B1,     public  B2
{
        D       (Initializer init): B1(init.b1()), B2(init.b2()) { }
};

int     main    (void)
{
        Initializer init;
        D           d(init);

        std::cout << "i_=" << d.i_ << std::endl;

        return  0;
}


-- 
           Summary: Member initialization by constructor parameter object
                    method calls
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Don at Skyler dot com


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


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

* [Bug c++/26029] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
@ 2006-01-30 13:06 ` pinskia at gcc dot gnu dot org
  2006-01-30 20:38 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-30 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-30 13:06 -------
This works for me on 3.4.0 and 4.1.0 on i686-linux-gnu.

Can you give the output of "gcc -v"?


-- 


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


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

* [Bug c++/26029] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
  2006-01-30 13:06 ` [Bug c++/26029] " pinskia at gcc dot gnu dot org
@ 2006-01-30 20:38 ` pinskia at gcc dot gnu dot org
  2006-01-30 21:36 ` brainchild at skyler dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-30 20:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/26029] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
  2006-01-30 13:06 ` [Bug c++/26029] " pinskia at gcc dot gnu dot org
  2006-01-30 20:38 ` pinskia at gcc dot gnu dot org
@ 2006-01-30 21:36 ` brainchild at skyler dot com
  2006-01-30 21:40 ` brainchild at skyler dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: brainchild at skyler dot com @ 2006-01-30 21:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from brainchild at skyler dot com  2006-01-30 21:36 -------
The gcc version is 3.4.4, the one in the current Cygwin distribution.

It must have been fixed since then, though.  I downloaded and built gcc 4.0.2
and it gives the correct output, i_=1.  So, I guess you can consider it
resolved.  If it worked on 3.4.0, maybe it was broken between 3.4.0 and 3.4.4,
then fixed between 3.4.4 and 4.0.2?  If so, may be useful info to have on file
for future reference, at least until Cygwin's distribution includes a later
version.

BTW, I am Don@Skyler.com; just posting from work instead of home.

Thanks!


-- 


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


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

* [Bug c++/26029] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
                   ` (2 preceding siblings ...)
  2006-01-30 21:36 ` brainchild at skyler dot com
@ 2006-01-30 21:40 ` brainchild at skyler dot com
  2006-01-30 21:42 ` brainchild at skyler dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: brainchild at skyler dot com @ 2006-01-30 21:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from brainchild at skyler dot com  2006-01-30 21:40 -------
Per your request, the --version output:

g++ (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- 


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


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

* [Bug c++/26029] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
                   ` (3 preceding siblings ...)
  2006-01-30 21:40 ` brainchild at skyler dot com
@ 2006-01-30 21:42 ` brainchild at skyler dot com
  2006-01-30 22:12 ` [Bug c++/26029] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2006-03-01  5:10 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: brainchild at skyler dot com @ 2006-01-30 21:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from brainchild at skyler dot com  2006-01-30 21:42 -------
Sorry, just realized that's not what you asked for.  Here is output of gcc -v:

$ ./gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr
--
exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib
--man
dir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,
java,objc --enable-nls --without-included-gettext
--enable-version-specific-runt
ime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib
--ena
ble-interpreter --disable-libgcj-debug --enable-threads=posix
--enable-java-gc=b
oehm --disable-win32-registry --enable-sjlj-exceptions
--enable-hash-synchroniza
tion --enable-libstdcxx-debug : (reconfigured)
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)


-- 


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


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

* [Bug c++/26029] [3.4 Regression] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
                   ` (4 preceding siblings ...)
  2006-01-30 21:42 ` brainchild at skyler dot com
@ 2006-01-30 22:12 ` pinskia at gcc dot gnu dot org
  2006-03-01  5:10 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-30 22:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-01-30 22:11 -------
Ok, I have now tried a 3.4.x and also a 3.3.x. and found some interesting
results.

Well it is a regression only in 3.4.1 and above and 3.3.5 and above.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.6 3.4.5
      Known to work|                            |3.4.0 3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-30 22:11:57
               date|                            |
            Summary|Member initialization by    |[3.4 Regression] Member
                   |constructor parameter object|initialization by
                   |method calls                |constructor parameter object
                   |                            |method calls
   Target Milestone|---                         |3.4.6


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


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

* [Bug c++/26029] [3.4 Regression] Member initialization by constructor parameter object method calls
  2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
                   ` (5 preceding siblings ...)
  2006-01-30 22:12 ` [Bug c++/26029] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2006-03-01  5:10 ` gdr at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2006-03-01  5:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2006-03-01 05:10 -------
Fixed in 4.0.0 and up.


-- 

gdr at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-03-01  5:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-30 13:01 [Bug c++/26029] New: Member initialization by constructor parameter object method calls Don at Skyler dot com
2006-01-30 13:06 ` [Bug c++/26029] " pinskia at gcc dot gnu dot org
2006-01-30 20:38 ` pinskia at gcc dot gnu dot org
2006-01-30 21:36 ` brainchild at skyler dot com
2006-01-30 21:40 ` brainchild at skyler dot com
2006-01-30 21:42 ` brainchild at skyler dot com
2006-01-30 22:12 ` [Bug c++/26029] [3.4 Regression] " pinskia at gcc dot gnu dot org
2006-03-01  5:10 ` gdr 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).