[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [llvm-bugs] [Bug 47692] New: Bogus -Winvalid-partial-specialization when specialization has `const a
From:       via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date:       2020-09-30 15:06:58
Message-ID: bug-47692-206 () http ! bugs ! llvm ! org/
[Download RAW message or body]

--1601478418.bbdcb7174.7534
Date: Wed, 30 Sep 2020 08:06:58 -0700
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.llvm.org/
Auto-Submitted: auto-generated

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@nondot.org
          Reporter: arthur.j.odwyer@gmail.com
                CC: htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org,
                    neeilans@live.com, richard-llvm@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.
--1601478418.bbdcb7174.7534
Date: Wed, 30 Sep 2020 08:06:58 -0700
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://bugs.llvm.org/
Auto-Submitted: auto-generated

<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Bogus -Winvalid-partial-specialization when specialization has `const \
auto&amp;` NTTP parameter"  \
href="https://bugs.llvm.org/show_bug.cgi?id=47692">47692</a>  </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bogus -Winvalid-partial-specialization when specialization has `const \
auto&amp;` NTTP parameter  </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs&#64;nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arthur.j.odwyer&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper&#64;gmail.com, llvm-bugs&#64;lists.llvm.org, \
neeilans&#64;live.com, richard-llvm&#64;metafoo.co.uk  </td>
        </tr></table>
      <p>
        <div>
        <pre>// <a href="https://godbolt.org/z/b7W4TY">https://godbolt.org/z/b7W4TY</a>
 template&lt;auto&amp;&gt; struct A { int i = 1; };
template&lt;const auto&amp; X&gt; struct A&lt;X&gt; { int i = 2; };

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

GCC and MSVC both accept this code, and do generate `A&lt;i&gt;` from the partial
specialization whenever `i` is a const variable.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>
--1601478418.bbdcb7174.7534--


[Attachment #3 (text/plain)]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic