[llvm-bugs] [Bug 31855] New: Clang-CL fails to compile struct with restrict member

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 3 02:59:01 PST 2017


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

            Bug ID: 31855
           Summary: Clang-CL fails to compile struct with restrict member
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ CL.exe ..\restrict-export.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

restrict-export.cpp
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:restrict-export.exe
restrict-export.obj
   Creating library restrict-export.lib and object restrict-export.exp

$ C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe ..\restrict-export.cpp
..\restrict-export.cpp(5,15):  error: cannot initialize a parameter of type
'void *' with an rvalue of type 'const int *__restrict (*)[1]'
struct EXPORT MyStruct
              ^~~~~~~~
..\restrict-export.cpp(12,14):  note: in instantiation of template class
'MyStruct<1>' requested here
        MyStruct<1> ms;
                    ^
..\restrict-export.cpp(5,15):  note: implicit copy assignment operator for
'MyStruct<1>' first required here
struct EXPORT MyStruct
              ^
..\restrict-export.cpp(5,8):  note: due to 'MyStruct' being dllexported
struct EXPORT MyStruct
       ^
..\restrict-export.cpp(2,27):  note: expanded from macro 'EXPORT'
#define EXPORT __declspec(dllexport)
                          ^
1 error generated.

$ type ..\restrict-export.cpp

#define EXPORT __declspec(dllexport)

template<int N>
struct EXPORT MyStruct
{
        const int* __restrict m_data[N];
};

int main ()
{
    MyStruct<1> ms;

    return 0;
}

-- 
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/20170203/7e28b9be/attachment.html>


More information about the llvm-bugs mailing list