This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71446] Incorrect overload resolution when using designated initializers
- From: "roman.perepelitsa at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Jun 2016 10:29:45 +0000
- Subject: [Bug c++/71446] Incorrect overload resolution when using designated initializers
- Auto-submitted: auto-generated
- References: <bug-71446-4 at http dot gcc dot gnu dot org/bugzilla/>
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".