Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

nondependent names in templates not seen in intel windows compiler

Milind_Kulkarni__Int
New Contributor II
279 Views
According to Ansi standard, the following code should produce result:--

f(int)

//////////////////////////
[bash]#include 

   void f(int) { printf("f(int)\n");}


template  void g(T) {
   f('a');   // calls f(char) should call f(int)
}

   void f(char) { printf("f(char)\n");}


int main() {
   g('c');
}
[/bash]
////////////////////////////////

But the output in Intel C++ Compiler for windows is :--

f(char)

Even if we use /Za (for strict-ansi in windows), above is the result.

Though in Linux environment, for Intel C++ Compiler (or gcc 4.1 compiler), the result is:--

f(int)

Is this a valid behaviour difference across both platforms, or is it a bug to be fixed
0 Kudos
2 Replies
Milind_Kulkarni__Int
New Contributor II
279 Views
The erroneous line in the code is as:--

template void g(T) {

Sorry for the type while inserting code.
0 Kudos
Judith_W_Intel
Employee
279 Views
Our goal on Windows is to be compatible with the Microsoft compiler. It makes no difference what the C++ standard says or what Gnu does.

It looks like for this example we behave exactly the same as Windows, with or without /Za. So this is not a bug.

BTW, /Za is documented inthe Microsoft compileras "disable Microsoft extensions" -- which is not the same as strict ansi. We do not currently support a strict ansi mode on Windows.
0 Kudos
Reply