[LLVMbugs] [Bug 10811] New: Terrible error on implicitly deleted default constructor in C++0x mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 29 21:30:15 PDT 2011


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

           Summary: Terrible error on implicitly deleted default
                    constructor in C++0x mode
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ cat test.cc
struct hash_int {
    int operator()(int i);
};

class Hasher {
    const hash_int hash_;
};

void foo() {
    Hasher h;
}
$ clang++ -std=c++0x -c test.cc
test.cc:10:12: error: call to deleted constructor of 'Hasher'
    Hasher h;
           ^
test.cc:5:7: note: function has been explicitly marked deleted here
class Hasher {
      ^
1 error generated.


--------

The C++98 error does a better job:

$ clang++ -c test.cc
test.cc:5:7: error: implicit default constructor for 'Hasher' must explicitly
initialize the const member 'hash_'
class Hasher {
      ^
test.cc:6:20: note: 'hash_' declared here
    const hash_int hash_;
                   ^
test.cc:10:12: note: implicit default constructor for 'Hasher' first required
here
    Hasher h;
           ^
1 error generated.

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