|
It looks to me like the problem is due to a template implementation not
being visible to the code being compiled. GCC and VC++ don't enforce
the C++ standard strictly here, and the CodeWarrior and EDG-based
compilers correctly flag this as invalid code. VC++ compiles templates
by essentially converting the entire declaration into a macro which
gets expanded only at the final front-end compilation stage, and thus
it doesn't templated code until later (which in fact the templated type
has become fully visible). GCC is somewhat like VC++ but seems to do a
certain amount of first-pass inspection of the template declaration
that catches some misusage within the template declaration itself, but
it still doesn't check or compile the template code upon its usage like
CodeWarrior and GCC do. The fix is to make the template declaration (as
opposed to a forward declaration) fully visible at the time of its
usage. I'm saying this based on experience and not because I have debugged this particular problem myself. So it could possibly be a different issue. But the error messages below, and the fact that it is occurring with EDG and not GCC and VC++, and because it involves templates rings all the bells of this problem. There is a related C++ problem which is more subtle. Consider this code that the compiler sees in the given order: 1) Declare template X 2) Use template X 3) Declare specialization of template X Most compilers incorrectly compile the specialization (line 3) into the usage at line 2. But the standard requires that the specialization be ignored, since it was not visible at the time line 2 was compiled. You can see why it is that a compiler which treats templates much like macros will get this wrong, as they don't compile line 2 until later and simply apply both the 'macros' declared at line 1 and 3. Paul
|
_______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

