[llvm-bugs] [Bug 44477] New: CRTP failing when declspec export

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 7 04:56:13 PST 2020


            Bug ID: 44477
           Summary: CRTP failing when declspec export
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

// t.cpp (c++17) https://godbolt.org/z/yCFtxo
template<class Derived>
struct Base
        static constexpr bool myBoolean = false;
        static constexpr auto getValue() -> bool
            return Derived::myBoolean;

struct __declspec(dllexport) Derived : Base<Derived>

// Error:
C++     t.cpp: Failed
t.cpp(26,23): error: no member named 'myBoolean' in 'Derived'
      return Derived::myBoolean;
t.cpp(20,8): note: in instantiation of member function
'Base<Derived>::getValue' requested here
struct Base
t.cpp(30,47): note: in instantiation of template class 'Base<Derived>'
requested here
struct __declspec(dllexport) Derived : public Base<Derived>
1 error generated. 

// Extra info:
 - Removing the __declspec(dllexport) doesn't give the error
 - Using the linux alternative __attribute__((visibility("default")))
@CompilerExplorer doesn't give the error on linux
 - Most likely an issue of clang-cl only

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/20200107/46d11e3b/attachment.html>

More information about the llvm-bugs mailing list