Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Milind_Kulkarni__Int
New Contributor II
35 Views

nondependent names in templates not seen in intel windows compiler

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
35 Views

The erroneous line in the code is as:--

template void g(T) {

Sorry for the type while inserting code.
Judith_W_Intel
Employee
35 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.
Reply