- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[cpp]templateclass edge_struct { public: typedef edge_struct * edge; V v_; E e_; F f_; }; template void Succ_Inout_Edge2(edge_struct * e) { typename edge_struct ::edge x; } template typename edge_struct ::edge Succ_Inout_Edge(typename edge_struct ::edge e) { typename edge_struct ::edge e2 = e; return e2; } void a(void) { edge_struct a; edge_struct ::edge e=0; Succ_Inout_Edge2 (e); } [/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
after checking with our front-end developers we created a ticket to consider removing the implicit typename feature for future compiler versions ([edit: using existing ticket] DPD200178660 DPD200135843).
You're right that this relict is hindering cross-development and confusing nowadays.
As soon as this is implemented I'll let you know.
Best regards,
Georg Zitzlsberger
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...
template< class V, class E, class F >
typename edge_struct< V, E, F >::edge Succ_Inout_Edge( typename edge_struct< V, E, F >::edge e )
{
typename edge_struct< V, E, F >::edge e2 = e;
return e2;
};
...
It was told many times that on Windows platforms Intel C/C++ compileris compatible with MSVC C/C++
compiler. So, this is whatMSVC outputs ifany of underlined 'typename' template specifiers removed:
...
... : warning C4346: 'edge_struct
... : error C2146: syntax error : missing ';' before identifier 'Succ_Inout_Edge'
... : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
... : fatal error C1903: unable to recover from previous error(s); stopping compilation
...
It looks like a featureofIntel C/C++ compiler for Windows, or a bug?
Best regards,
Sergey
PS: 'g++'compiler for Windowsalso fails...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please take a look atoutput ofVisual C++in aPost #2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would expect the same version of the Intel compiler on Linux and Windows would , with the "appropriate" options , behave the same way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
that's indeed because of different behavior between Linux* & Windows* versions in terms of compatibility.
Following the C++ standard it requires typename. For Linux* we conform to that, hence you're seeing an error there.
But why don't we error with the Windows* version, too? Well, VS compilers before 2003 had a feature to "detect" missing typename keywords (implicit typename feature). Back in 2009 we already discussed that internally but the only "problem" was that our compiler would also tolerate less strict C++ code. As we're missing a hard case proving this wrong we still support the implicit typename feature... for Windows* platforms.
If you find an example where the implicit typename feature causes problems, please let me know.
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, but as Sergey mentioned it's a feature here. The opposite would be a real problem for our compiler.
I admit that having an option to disable this (or vice versa) would aid in creating standards-compliant code, though.
Besides this observation, is it a real problem for your development or rather theoretic?
Best regards,
Georg Zitzlsberger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The easiest way fior me was to temporarily switch to the MS Visual Studio 2010 compiler on Windows which at least caught the worst errors, then do the final set of fixes on linux.
e.g. MS Visual Studio accepts typename const XXXX whereas the correct form, I gather, is const typename XXXX
I suppose we have a situation where MS Compiler (Windows) <> Intel Compiler (windows) <> Intel compiler (Linux). Not sure that is ideal, really.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, but as Sergey mentioned it's a feature here.
[SergeyK] Actually, my statement was:
It looks like a featureofIntel C/C++ compiler for Windows, or a bug?
The opposite would be a real problem for our compiler.
[SergeyK] Now I think, it is more a "bug" than a "feature".
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...
#if defined (_LINUX32 )
#if _ICC_VER ==
#define DeclTypename typename
#define ImplTypename typename
#endif
#endif
#if defined ( _WIN32 )
#if _MSC_VER == 1600 // VS2010
#define DeclTypename
#define ImplTypename
#endif
#endif
...
...
template< class V, class E, class F >
DeclTypename edge_struct< V, E, F >::edge Succ_Inout_Edge( DeclTypename edge_struct< V, E, F >::edge e )
{
ImplTypename edge_struct
return e2;
}
...
Of course, it could be more complex in your case...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
after checking with our front-end developers we created a ticket to consider removing the implicit typename feature for future compiler versions ([edit: using existing ticket] DPD200178660 DPD200135843).
You're right that this relict is hindering cross-development and confusing nowadays.
As soon as this is implemented I'll let you know.
Best regards,
Georg Zitzlsberger

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page