[llvm-bugs] [Bug 51401] New: Various problems with CTAD and disignated initialisers

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 7 08:51:49 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51401

            Bug ID: 51401
           Summary: Various problems with CTAD and disignated initialisers
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: h2+bugs at fsfe.org
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

All the code below builds with GCC>=10 and -std=c++20.
All except the two marked examples also build with MSVC.

Everything after "Outer2 o22" fails with Clang.

```c++
struct Inner
{
    int i = 0;
};

struct Outer1
{
    Inner s{};
};

template <typename T = int>
struct Outer2
{
    Inner s{};
};

template <typename T>
struct Outer3
{
    T s{};
};

int main()
{
    Outer1 o1{};
    Outer1 o2{{}};
    Outer1 o3{Inner{}};
    Outer1 o4{Inner{1}};
    Outer1 o5{.s = Inner{}};
    Outer1 o6{.s = Inner{ .i = 1}};

    Outer2 o21{};
    Outer2 o22{{}};
    Outer2 o23{Inner{}};                // fails in MSVC
    Outer2 o24{Inner{1}};               // fails in MSVC
    Outer2 o25{.s = Inner{}};
    Outer2 o26{.s = Inner{ .i = 1}};

    Outer3 o33{Inner{}};
    Outer3 o34{Inner{1}};
    Outer3 o35{.s = Inner{}};
    Outer3 o36{.s = Inner{ .i = 1}};
}
```

-- 
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/20210807/6c0bc5e4/attachment.html>


More information about the llvm-bugs mailing list