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

            Bug ID: 47704
           Summary: Overloading resolved to pointer argument instead of
                    initializer_list
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

For the following C++11 code:

#include <initializer_list>

struct V
{
    V(int) {}
};

inline int f(void*) { return 1; }

inline int f(std::initializer_list<V>) { return 2; }

int invoke_test() { return f({0}); }


The function f invocation f({0}) is resolved to f(void*).
GCC does the opposite.
I believe it should be initializer_list because {} is used.
We also get the -Wbraced-scalar-init warning.

warning: braces around scalar initializer [-Wbraced-scalar-init]

int invoke_test() { return f({0}); }

                             ^~~

https://godbolt.org/z/qj5voh

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to