http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54198

             Bug #: 54198
           Summary: [4.8 Regression]  "error: invalid use of incomplete
                    type" when building Chromium
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mar...@trippelsdorf.de


Chromium (22.0.1229.0) fails to build with current gcc trunk:

In file included from third_party/WebKit/Source/WTF/wtf/RefPtr.h:28:0,
                 from third_party/WebKit/Source/WTF/wtf/VectorTraits.h:25,
                 from third_party/WebKit/Source/WTF/wtf/Vector.h:30,
                 from third_party/WebKit/Source/WTF/wtf/text/StringImpl.h:31,
                 from third_party/WebKit/Source/WTF/wtf/text/WTFString.h:29,
                 from
third_party/WebKit/Source/WebCore/platform/text/PlatformString.h:28,
                 from third_party/WebKit/Source/WebCore/platform/KURL.h:30,
                 from third_party/WebKit/Source/WebCore/platform/KURLHash.h:29,
                 from third_party/WebKit/Source/WebCore/css/CSSRule.h:26,
                 from third_party/WebKit/Source/WebCore/css/CSSImportRule.h:25,
                 from out/Release/obj/gen/webkit/bindings/V8CSSImportRule.h:24,
                 from
out/Release/obj/gen/webcore/bindings/V8CSSImportRule.cpp:22,
                 from
out/Release/obj/gen/webkit/bindings/V8DerivedSources03.cpp:31:
third_party/WebKit/Source/WTF/wtf/PassRefPtr.h: In instantiation of ‘void
WTF::refIfNotNull(T*) [with T = WebCore::MetadataCallback]’:
third_party/WebKit/Source/WTF/wtf/PassRefPtr.h:60:43:   required from
‘WTF::PassRefPtr<T>::PassRefPtr(T*) [with T = WebCore::MetadataCallback]’
third_party/WebKit/Source/WebCore/Modules/filesystem/Entry.h:54:69:   required
from here
third_party/WebKit/Source/WTF/wtf/PassRefPtr.h:46:13: error: invalid use of
incomplete type ‘class WebCore::MetadataCallback’
             ptr->ref();
             ^
In file included from
third_party/WebKit/Source/WebCore/Modules/filesystem/DOMFileSystem.h:37:0,
                 from out/Release/obj/gen/webkit/bindings/V8DOMFileSystem.h:26,
                 from
out/Release/obj/gen/webcore/bindings/V8DOMFileSystem.cpp:22,
                 from
out/Release/obj/gen/webkit/bindings/V8DerivedSources03.cpp:54:
third_party/WebKit/Source/WebCore/Modules/filesystem/DOMFileSystemBase.h:52:7:
error: forward declaration of ‘class WebCore::MetadataCallback’
 class MetadataCallback;
       ^

The testcase is too big to attach (416KB bziped).

I've reduced it with C-reduce:

markus@x4 tmp % cat test.ii
template <typename T> void
refIfNotNull (T* p1)
{
    p1->ref;
}
template <typename T> struct A
{
    A (T* p1)
    {
        refIfNotNull (p1);
    }
};
class B;
class C
{
    void getParent (A <B> = 0);
};

markus@x4 tmp % g++ -c test.ii
test.ii: In instantiation of ‘void refIfNotNull(T*) [with T = B]’:
test.ii:10:9:   required from ‘A<T>::A(T*) [with T = B]’
test.ii:16:29:   required from here
test.ii:4:5: error: invalid use of incomplete type ‘class B’
     p1->ref;
     ^
test.ii:13:7: error: forward declaration of ‘class B’
 class B;
       ^

Reply via email to