Skip to content

clang c++ virtual methods for templated class not instantiated with instantiation of constructor #5929

@efriedma-quic

Description

@efriedma-quic
Bugzilla Link 5557
Resolution FIXED
Resolved on Feb 22, 2010 12:53
Version unspecified
OS Linux
Blocks #5883
CC @DougGregor

Extended Description

Testcase:
template struct A {
A();
virtual int a(T x);
};
template A::A() {}
template int A::a(T x) { return *x; }
A x;
int main() { return 0; }

Output (clang x.cpp -fno-rtti):
/tmp/cc-nJeNb1.o:(.gnu.linkonce.r._ZTV1AIiE+0x8): undefined reference to `A::a()'
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compare to output from g++:
/tmp/x.cpp: In member function ‘int A::a(T) [with T = int]’:
/tmp/x.cpp:10: instantiated from here
/tmp/x.cpp:8: error: invalid type argument of ‘unary *’

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions