[llvm-bugs] [Bug 38490] New: __uuidof not constexpr

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 8 14:38:51 PDT 2018


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

            Bug ID: 38490
           Summary: __uuidof not constexpr
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: charles.milette at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

When compiling the following code:

    #include <dxgi1_2.h>

    static constexpr auto test = __uuidof(IDXGIDevice1);

With clang, a compiler error is generated because __uuidof is not considered
constexpr:

    dxgi.cpp:3:23: error: constexpr variable 'test' must be initialized by a
constant expression
    static constexpr auto test = __uuidof(IDXGIDevice1);
                      ^      ~~~~~~~~~~~~~~~~~~~~~~
    dxgi.cpp:3:30: note: subexpression not valid in a constant expression
    static constexpr auto test = __uuidof(IDXGIDevice1);
                             ^
    dxgi.cpp:3:30: note: in call to '_GUID(__uuidof(IDXGIDevice1))'
    1 error generated.

Meanwhile with MSVC, __uuidof is indeed considered constexpr, so the code
builds fine.

-- 
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/20180808/04484a4c/attachment.html>


More information about the llvm-bugs mailing list