[llvm-bugs] [Bug 42923] New: conflicting types error when using '_com_ptr_t' on clang 9.0 RC

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 14:43:13 PDT 2019


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

            Bug ID: 42923
           Summary: conflicting types error when using '_com_ptr_t' on
                    clang 9.0 RC
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Zachary.Henkel at microsoft.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

clang 9.0 RC built with msvc version 19.22.27905 for x64.  The attached example
compiles fine on clang 8.0.1 and on msvc.  

An odd thing that I noticed is that -std=c++14 works fine, it's only -std=c++17
that causes these errors.

I've attached a fully preprocessed file in case an msvc installation & clang-cl
aren't handy.  Run clang -c -Wno-everything -std=c++17 min_repro.cpp

D:\>clang -c -Wno-everything -std=c++17  D:\temp\min_repro.cpp
D:\temp\min_repro.cpp:67792:16: error: conflicting types for '_com_ptr_t'
    template<> _com_ptr_t(Interface* pInterface) throw()
               ^
D:\temp\min_repro.cpp:68735:13: note: in instantiation of template class
'_com_ptr_t<_com_IIID<IUnknown,
      &__uuidof(IUnknown)> >' requested here
IUnknownPtr Foo() {
            ^
D:\temp\min_repro.cpp:67792:16: note: previous declaration is here
    template<> _com_ptr_t(Interface* pInterface) throw()
               ^
D:\temp\min_repro.cpp:67865:28: error: conflicting types for 'operator='
    template<> _com_ptr_t& operator=(Interface* pInterface) throw()
                           ^
D:\temp\min_repro.cpp:67865:28: note: previous declaration is here
D:\temp\min_repro.cpp:68011:21: error: conflicting types for 'operator=='
    template<> bool operator==(const _com_ptr_t& p) const throw()
                    ^
D:\temp\min_repro.cpp:68011:21: note: previous declaration is here
3 errors generated.

Optionally if an msvc command prompt is available:
D:\>type repro.cpp
#include <comdef.h>

IUnknownPtr Foo() {
    return nullptr;
}

D:\>clang-cl.exe -c -std:c++17 -TP -W0 repro.cpp
** Same Errors

-- 
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/20190807/02dcb375/attachment.html>


More information about the llvm-bugs mailing list