Comment 7 for bug 305460

Revision history for this message
In , Rearnsha (rearnsha) wrote :

As suggested, there's no bug in the compiler here, and the error message comes from the linker. The linker doesn't know what the key function is, so I doubt it could issue a more accurate diagnostic.

In fact, the key function is just a trigger to the compiler to cause it to emit the meta-data for the class exactly once -- and because there the class could be used in multiple compilation units it can never know which one should contain the meta data as any of them could have done. As far as the linker is concerned, there really is no class for A; it's the same as if there was no definition for a global extern variable.