[LLVMbugs] [Bug 20337] New: "invalid application of 'sizeof' to an incomplete type" in msvc mode

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 16 18:39:06 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20337

            Bug ID: 20337
           Summary: "invalid application of 'sizeof' to an incomplete
                    type" in msvc mode
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

(similar to issue 20221, but this is with clang r213197, so it does have the
fix for that)

Consider:

$ cat test.cc
template<typename T> class OwnPtr {
public:
    ~OwnPtr()
    {
        _Static_assert((sizeof(T) > 0), "TypeMustBeComplete");
    }
};

class SVGElement {
public:
    virtual ~SVGElement();
};

class ScriptLoader;

class SVGScriptElement final : public SVGElement {
    virtual bool isStructurallyExternal() const { return hasSourceAttribute();
}
    virtual bool hasSourceAttribute() const ;

    OwnPtr<ScriptLoader> m_loader;
};

$ ../../llvm-build/bin/clang -c test.cc -std=c++11  # Works.
$ ../../llvm-build/bin/clang -c test.cc -target i386-pc-windows-msvc
test.cc:5:25: error: invalid application of 'sizeof' to an incomplete type
'ScriptLoader'
        _Static_assert((sizeof(T) > 0), "TypeMustBeComplete");
                        ^~~~~~~~~
test.cc:16:7: note: in instantiation of member function
'OwnPtr<ScriptLoader>::~OwnPtr' requested here
class SVGScriptElement final : public SVGElement {
      ^
test.cc:14:7: note: forward declaration of 'ScriptLoader'
class ScriptLoader;
      ^
1 error generated.



This builds fine with cl.exe too.

-- 
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/20140717/d884d47f/attachment.html>


More information about the llvm-bugs mailing list