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

            Bug ID: 48331
           Summary: CV qualifiers are incorrectly stripped from the type
                    of void prvalues
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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: https://godbolt.org/z/z3PebY

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

ICC is correct. The correct type is const void per [expr.type.conv]/2:
> 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.

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

Reply via email to