[LLVMbugs] [Bug 23542] New: dllexport on class with in-class initializers causes error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 15 16:32:17 PDT 2015


            Bug ID: 23542
           Summary: dllexport on class with in-class initializers causes
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ bin/clang -target i386-pc-win32 -x c++ -c -
struct __declspec(dllexport) S {
  int x = 42;
<stdin>:2:7: error: cannot use defaulted default constructor of 'S' within the
class outside of member functions because 'x' has an initializer
  int x = 42;
<stdin>:1:30: note: implicit default constructor for 'S' first required here
struct __declspec(dllexport) S {
<stdin>:1:19: note: due to 'S' being dllexported
struct __declspec(dllexport) S {
1 error generated.

We're instantiating the default constructor due to the dllexport, and it
happens before we've parsed the in-class initializer.

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/20150515/7e118ea5/attachment.html>

More information about the llvm-bugs mailing list