[LLVMbugs] [Bug 10457] New: Delegating constructor doesn't seem to delegate

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 23 12:12:30 PDT 2011


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

           Summary: Delegating constructor doesn't seem to delegate
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++0x
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hhinnant at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Apple clang version 3.0 (tags/Apple/clang-210.3) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.0.0
Thread model: posix


#include <cstddef>
#include <stdio.h>

class string
{
    const char* data_;

    string(const char* str, std::size_t N);
public:
    template <std::size_t N>
        string(const char (&str)[N])
            : string(str, N) {}
};

string::string(const char* str, std::size_t N)
{
    printf("hi\n");
}

int main()
{
    string s("hi");
}

clang++ -std=c++0x  test.cpp

I don't get any output.  I expect the debugging "hi" print statement in
string::string(const char* str, std::size_t N) to get called.  If I rewrite the
private constructor as a private init() function, then I see the behavior I'm
expecting.

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