[llvm-bugs] [Bug 47692] New: Bogus -Winvalid-partial-specialization when specialization has `const auto&` NTTP parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 30 08:06:58 PDT 2020


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

            Bug ID: 47692
           Summary: Bogus -Winvalid-partial-specialization when
                    specialization has `const auto&` NTTP parameter
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

// https://godbolt.org/z/b7W4TY
template<auto&> struct A { int i = 1; };
template<const auto& X> struct A<X> { int i = 2; };

====
<source>:2:32: error: class template partial specialization is not more
specialized than the primary template [-Winvalid-partial-specialization]
template<const auto& X> struct A<X> { int i = 2; };
                               ^
<source>:1:24: note: template is declared here
template<auto&> struct A { int i = 1; };
                       ^
1 error generated.
====

GCC and MSVC both accept this code, and do generate `A<i>` from the partial
specialization whenever `i` is a const variable.

-- 
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/20200930/ca82257d/attachment.html>


More information about the llvm-bugs mailing list