This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71446] Incorrect overload resolution when using designated initializers


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71446

--- Comment #1 from Roman Perepelitsa <roman.perepelitsa at gmail dot com> ---
The same bug can lead to incorrect behaviour at run time.

  #include <stdio.h>
  #include <initializer_list>

  struct S {
    int value;
  };

  void F(S) { puts("right"); }
  void F(std::initializer_list<int>) { puts("wrong"); }

  int main() {
    F({.value = 0});
  }

Should print "right" but actually prints "wrong".

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]