Skip to content

Chromium build broken after r124565 #9489

@zmodem

Description

@zmodem
Bugzilla Link 9117
Resolution DUPLICATE
Resolved on Feb 02, 2011 04:19
Version trunk
OS Linux
CC @nico

Extended Description

r124565 changed something related to inlining and virtual functions, which breaks compilation of Chromium/WebKit.

Test case:

template void derefIfNotNull(T* ptr) {
ptr->deref();
}

template class RefPtr {
public:
RefPtr() : m_ptr(0) {}

~RefPtr() {
derefIfNotNull(m_ptr);
}

private:
T* m_ptr;
};

class Node;

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

class MyClass : public BaseWithVirtualDtor {
public:
virtual void doStuff() const;

private:
RefPtr m_base;
};

void f(MyClass* x) {
x->doStuff();
}

Error:

$ ./clang++ -c /tmp/a.cc
/tmp/a.cc:2:6: error: member access into incomplete type 'Node'
ptr->deref();
^
/tmp/a.cc:10:5: note: in instantiation of function template specialization
'derefIfNotNull' requested here
derefIfNotNull(m_ptr);
^
/tmp/a.cc:24:7: note: in instantiation of member function 'RefPtr::~RefPtr'
requested here
class MyClass : public BaseWithVirtualDtor {
^
/tmp/a.cc:17:7: note: forward declaration of 'Node'
class Node;
^
1 error generated.

Clang version:

$ ./clang++ --version
clang version 2.9 (trunk 124659)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclangClang issues not falling into any other categoryduplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions