http://llvm.org/bugs/show_bug.cgi?id=7244
Summary: Compilation error while using forward declared class
in template function
Product: clang
Version: unspecified
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
// Extracted from webkit
struct JSCell {};
struct JSValue {
JSValue(JSCell *) {}
};
struct JSNode;
template<class WrapperClass> inline JSValue getDOMNodeWrapper(JSNode* wrapper)
{
return wrapper;
}
struct JSNode : JSCell {};
int main()
{
getDOMNodeWrapper<int>(0);
return 0;
}
/*
test.cpp:12:12: error: no viable conversion from 'JSNode *' to 'JSValue'
return wrapper;
^~~~~~~
test.cpp:4:8: note: candidate constructor (the implicit copy constructor) not
viable: cannot convert argument of incomplete type 'JSNode *' to 'JSValue const
&'
struct JSValue {
^
test.cpp:5:5: note: candidate constructor not viable: cannot convert argument
of incomplete type 'JSNode *' to 'JSCell *'
JSValue(JSCell *) {}
^
1 error generated.
*/
GCC compiles this code fine.
But I think this might be a bug in GCC. In that case, WebKit would need to be
fixed instead.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs