[LLVMbugs] [Bug 6772] New: Not an error for gcc -- error: default initialization of an object of const type '...' requires a user-provided default constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 3 05:33:27 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6772

           Summary: Not an error for gcc -- error: default initialization
                    of an object of const type '...' requires a
                    user-provided default constructor
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nms+llvm at otdel-1.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Script started on Sat Apr  3 16:29:45 2010
$ cat ccd.cpp
struct A {
        A() {}
};

class B {
        A a_;
};

int
foo()
{
        const B b;
        return 0;
}
$ g++ --version
g++ (GCC) 4.2.1 20070719  [FreeBSD]
Copyright (C) 2007 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.

$ g++ -c ccd.cpp
$ clang++ --version
clang version 1.5 (trunk)
Target: i386-portbld-freebsd9.0
Thread model: posix
$ clang++ -c ccd.cpp
ccd.cpp:12:10: error: default initialization of an object of const type 'B
const' requires a user-provided default constructor
        const B b;
                ^
1 diagnostic generated.
$ ^D
Script done on Sat Apr  3 16:30:29 2010

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list