Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various problems with CTAD and disignated initialisers #50743

Closed
h-2 opened this issue Aug 7, 2021 · 6 comments
Closed

Various problems with CTAD and disignated initialisers #50743

h-2 opened this issue Aug 7, 2021 · 6 comments
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" compile-fail Use [accepts-invalid] and [rejects-valid] instead duplicate Resolved as duplicate

Comments

@h-2
Copy link
Member

h-2 commented Aug 7, 2021

Bugzilla Link 51401
Version 12.0
OS All
CC @alagner,@zygoloid

Extended Description

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.

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}};
}
@alagner
Copy link
Mannequin

alagner mannequin commented Aug 7, 2021

I'd like to add one more, possibly related (or I can create a separate bug if you think it's a different issue):
https://gcc.godbolt.org/z/ohaW4W45o

Exact excerpts from standard that explain it are here:
https://stackoverflow.com/a/68688850/4885321

struct A { int i; };
struct B { A a; };

int main() {
[[maybe_unused]] B z{.a = 1}; //this should not compile
}

@h-2
Copy link
Member Author

h-2 commented Aug 9, 2021

I'd like to add one more, possibly related (or I can create a separate bug
if you think it's a different issue):
https://gcc.godbolt.org/z/ohaW4W45o

Exact excerpts from standard that explain it are here:
https://stackoverflow.com/a/68688850/4885321

struct A { int i; };
struct B { A a; };

int main() {
[[maybe_unused]] B z{.a = 1}; //this should not compile
}

I think it would be good to have yours separate, because it is of the kind "accepts-invalid", while mine are of the kind "rejects-valid".

@h-2
Copy link
Member Author

h-2 commented Sep 3, 2021

Any news on this issue? Can you confirm?

Thanks!

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@ilya-biryukov
Copy link
Contributor

These are examples for an unimplemented parts of C++20: #54049 and #54050

@yuanfang-chen
Copy link
Collaborator

duplicate #54049 and #54050

@EugeneZelenko EugeneZelenko added duplicate Resolved as duplicate clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 5, 2023
@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 5, 2023

@llvm/issue-subscribers-clang-frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++20 clang:frontend Language frontend issues, e.g. anything involving "Sema" compile-fail Use [accepts-invalid] and [rejects-valid] instead duplicate Resolved as duplicate
Projects
Status: Done
Development

No branches or pull requests

5 participants