[llvm-bugs] [Bug 49808] New: Incorrect partial specialization selected for zero-length-array type

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 1 10:46:21 PDT 2021


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

            Bug ID: 49808
           Summary: Incorrect partial specialization selected for
                    zero-length-array type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthewjbarichello at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Affected versions:
 - trunk
 - 11.0.1
 - 11.0.0
 - 10.0.1
 - 10.0.0
 - 9.0.1
 - 9.0.0
 - 8.0.1
 - 8.0.0
 - 7.1.0
 - 7.0.1
 - 7.0.0
 - 6.0.1
 - 6.0.0
 - 5.0.1
 - 5.0.0
 - 4.0.1
 - 4.0.0

Driver cmdline:
Note: For clang 4.0.1 and 4.0.0, '-std=c++1z' was substituted for '-std=c++17'
 clang++ -std=c++17

Code:
 #include<type_traits>

 tempalte<typename>
 struct A : std::false_type {};

 template<typename T, auto N>
 struct A<T[N]> : std::true_type {};

 static_assert(A<int[0]>::value);

Expected behaviour:
The static assertion passes; the 'A<T[N]>' partial specialization should've
been selected.

Actual behaviour:
The static assertion fails; the base template is selected

Notes:
Even when adding the following partial specialization, the base template is
still, incorrectly, selected:
 template<typename T>
 struct A<T[0]> : std::true_type {};

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210401/ddc2b9d8/attachment-0001.html>


More information about the llvm-bugs mailing list