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

Reply via email to