clang problem with virtual functions

Either I'm missing something really obvious about virtual functions in
C++, or there's a bug in clang.

I have a really simple testcase here:

with the following main program file. Foo is a simple class with pure
virtual methods; Bar is a class that implements those.

#include <stdio.h>
#include "Bar.h"

Bar bar1, bar2;

void fibify(Foo& foo)

int getfact(Foo& foo)
    return foo.factorial(foo.getValue());

int main(int argc, char **argv)
        // fibify(bar2);
        printf("bar1.getValue() = %d\n", bar1.getValue());
        printf("bar2.getValue() = %d\n", bar2.getValue());
        printf("bar1.factorial(bar1.getValue()) = %d\n",
        // printf("getfact(bar1) = %d\n", getfact(bar1));
        return 0;

oops, I clipped a few lines off of the output. The error occurs when I
use clang to compile the linked bitcode into a native executable.

Build failed
-> task in 'opt1' failed (exit status 1):
  {task 19107152: opt1 opt1.bc -> opt1}
' /opt/local/libexec/llvm-3.1/bin/clang src/opt1.bc -o src/opt1 '

You need to link in the appropriate C++ libraries for your platform. Use clang++ to link.