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

CWG2680 [over.class.match.deduct] CTAD for aggregates with designated initializers #216

Open
cmeerw opened this issue Jan 10, 2023 · 1 comment

Comments

@cmeerw
Copy link

cmeerw commented Jan 10, 2023

Full name of submitter (unless configured in github; will be published with the issue): Christof Meerwald

Reference (section label): over.class.match.deduct

Link to reflector thread (if any): CTAD for aggregates with designated initializers

Issue description: Examples like

  template<typename T>
  struct X
  {
    int i{};
    T t;
  };

  X x{ .t = X<int>{ 1, 2 } }; // should deduce X<X<int>> (not X<int>)

and

  template<typename T>
  struct Y
  {
    int i;
    T t;
    int j;
  };

  template<typename T>
  Y(int, T) -> Y<T>;

  Y y{ .t = 'c', .j = 2 }; // should be ill-formed

result in unexpected deduced types as CTAD doesn't limit deduction to the aggregate deduction candidate when a designated initializer list is used.

Suggested resolution: see Re: CTAD for aggregates with designated initializers

over.match.list should consider only the aggregate deduction candidate (if any) when given a designated-initializer-list.

also Re: CTAD for aggregates with designated initializers

@jensmaurer jensmaurer changed the title [over.class.match.deduct] CTAD for aggregates with designated initializers CWG2680 [over.class.match.deduct] CTAD for aggregates with designated initializers Jan 14, 2023
@jensmaurer
Copy link
Member

CWG2680

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants