<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 - CV qualifiers are incorrectly stripped from the type of void prvalues"
   href="https://bugs.llvm.org/show_bug.cgi?id=48331">48331</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CV qualifiers are incorrectly stripped from the type of void prvalues
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jason.e.cobb@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When creating a prvalue of a cv void type, cv qualifiers are incorrectly
stripped.

Consider:
BEGIN EXAMPLE

#include <type_traits>

template<typename T>
using id_t = T;

static_assert(std::is_same_v<decltype(id_t<void const>()), void>);

END EXAMPLE

On Compiler Explorer: <a href="https://godbolt.org/z/z3PebY">https://godbolt.org/z/z3PebY</a>

GCC, Clang, and MSVC accept. ICC rejects, believing the type to instead be
const void (<a href="https://godbolt.org/z/Tqvjoo">https://godbolt.org/z/Tqvjoo</a>). The results are similar for
volatile.

ICC is correct. The correct type is const void per [expr.type.conv]/2:
<span class="quote">> Otherwise, if the type is cv void and the initializer is () or {} (after pack expansion, if any), the expression is a prvalue of the specified type that performs no initialization.</span ></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>