[LLVMbugs] [Bug 22809] New: struct type alias with 'using' doesn't match correct constructor when defined inside the class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 5 09:26:53 PST 2015


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

            Bug ID: 22809
           Summary: struct type alias with 'using' doesn't match correct
                    constructor when defined inside the class
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: qigopsrtv at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <iostream>

struct c
{
    using t1 = struct {int z;};
    using t2 = struct {double z;};
    using t3 = struct {float z;};
    using t4 = struct {float z;};

    c(t1) { std::cout << 1; }
    c(t2) { std::cout << 2; }
    c(t3) { std::cout << 3; }
    c(t4) { std::cout << 4; }
};

int main()
{
    c a1{c::t1()};
    c a2{c::t2()};
    c a3{c::t3()};
    c a4{c::t4()};
    return 0;
}

This code should display '1234' but prints '4444' instead. If I move the alias
definitions outside the class it works as expected.

$ clang --version    
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150305/00494c14/attachment.html>


More information about the llvm-bugs mailing list