When some STL containers are created, explicit constructors for contained
objects are treated as converting constructors. The keyword "explicit" is
ignored, and no error message is issued; see the code.

#include <vector>
#include <deque>

class X {
        public:
                explicit X(int) {}
};

int main() {
        int a[1] = {};
        std::vector<X> v(a, a + 1);
        std::deque<X> d(a, a + 1);
}


-- 
           Summary: STL treats explicit constructors as converting
                    constructors
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: konto dot dydaktyczne at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to