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

            Bug ID: 44449
           Summary: Implicit conversion error, adding qualifiers
                    (non-const to const), with reference to array.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: choon-ho.c...@vitrox.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

As title, refer to example, https://godbolt.org/z/yFx-Zz

/////////////////////////////////

#include <type_traits>

void f(const void* const (*)[1]);

void g(const void* const (&)[1]);

void test()
{
    static_assert(std::is_convertible<void* (*)[], const void* const
(*)[]>::value, ""); // fails in msvc.
    static_assert(std::is_convertible<void* (&)[], const void* const
(&)[]>::value, ""); // fails in msvc, clang.

    void* x[1];

    f(&x); // fails in msvc.
    g( x); // fails in msvc, clang.
}

/////////////////////////////////

MSVC aside, GCC (trunk) passes both cases, Clang rejects the reference case.
I find this inconsistency weird, could this be a potential bug or the language
left it unspecified.

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

Reply via email to