public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40173]  New: Calling a constructor from another constructor of the same class
@ 2009-05-16 17:30 raven at student dot pwr dot wroc dot pl
  2009-05-16 17:33 ` [Bug c++/40173] " pinskia at gcc dot gnu dot org
  2009-05-16 18:38 ` paolo dot carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: raven at student dot pwr dot wroc dot pl @ 2009-05-16 17:30 UTC (permalink / raw)
  To: gcc-bugs

Command line: g++ -pedantic -Wall -o test test.cpp
Compiler output: none


Basically, I created a class with two constructors. One of those is
trying to call the other one. The call doesn't seem to have any effect
at all.

The problem is: g++ allows such a thing with no warnings at all.

Apart from that, I believe such functionality might be useful. For
example, if we've got a constructor with one parameter and quite a
heavy block of code, along with another constructor that takes no
arguments - which we'd like to be a wrapper for the first one, passing
some kind of default value to it.

Thanks for your time ;)


-- 
           Summary: Calling a constructor from another constructor of the
                    same class
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raven at student dot pwr dot wroc dot pl
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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


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

* [Bug c++/40173] Calling a constructor from another constructor of the same class
  2009-05-16 17:30 [Bug c++/40173] New: Calling a constructor from another constructor of the same class raven at student dot pwr dot wroc dot pl
@ 2009-05-16 17:33 ` pinskia at gcc dot gnu dot org
  2009-05-16 18:38 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-05-16 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-05-16 17:33 -------
>The call doesn't seem to have any effect at all.

Yes it does, it creates another object and calls that constructor.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/40173] Calling a constructor from another constructor of the same class
  2009-05-16 17:30 [Bug c++/40173] New: Calling a constructor from another constructor of the same class raven at student dot pwr dot wroc dot pl
  2009-05-16 17:33 ` [Bug c++/40173] " pinskia at gcc dot gnu dot org
@ 2009-05-16 18:38 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-16 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-05-16 18:38 -------
Note, in the next C++ Standard, what the user wants will be possible, see,
e.g.:

  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf


-- 


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


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

end of thread, other threads:[~2009-05-16 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-16 17:30 [Bug c++/40173] New: Calling a constructor from another constructor of the same class raven at student dot pwr dot wroc dot pl
2009-05-16 17:33 ` [Bug c++/40173] " pinskia at gcc dot gnu dot org
2009-05-16 18:38 ` paolo dot carlini at oracle dot com

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).