473,507 Members | 9,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

another .2003 issue to be verified


VC 2003 calls f(char const*) for the following code, but it should call
the function template as f(char const*) is no perfect match (because of
decay).

Please could someone analyze the behaviour in VC .2005?

Thanks, Stefan
template <typename T>
void f(T const&)
{
// this one should be called!
}

void f(const char *)
{
}

int main()
{
char buf[] = "abc";
f(buf);
}
Nov 17 '05 #1
5 931
Stefan Slapeta wrote:

[...]

BTW, seems to no be no open issue for this; I'm going to submit one if
VC 2005 is still wrong.

Stefan
Nov 17 '05 #2
>VC 2003 calls f(char const*) for the following code

VS2005 B1 does the same.

Dave
Nov 17 '05 #3
David Lowndes wrote:
VC 2003 calls f(char const*) for the following code

VS2005 B1 does the same.


Thanks. I've entered Bug FDBK22888.

Stefan
Nov 17 '05 #4
Stefan Slapeta wrote:

VC 2003 calls f(char const*) for the following code, but it should call
the function template as f(char const*) is no perfect match (because of
decay).
I think it's because of the qualification adjustment actually - decay
alone (a form of Lvalue Transformation) would mean that the two were
ambiguous apart from the second being a non-template, so that would win
(change to void f(char*) to see this effect on a conforming compiler).
See 13.3.3.2/3:

"S1 is a proper subsequence of S2 (comparing the conversion sequences in
the canonical form defined by 13.3.3.1.1, excluding any Lvalue
Transformation; the identity conversion sequence is considered to be a
subsequence of any non-identity conversion sequence)"
Please could someone analyze the behaviour in VC .2005?


Pass, sorry about the unnecessary correction!

Tom
Nov 17 '05 #5
Tom Widmer wrote:

I think it's because of the qualification adjustment actually - decay
alone (a form of Lvalue Transformation) would mean that the two were
ambiguous apart from the second being a non-template, so that would win
(change to void f(char*) to see this effect on a conforming compiler).
See 13.3.3.2/3:

"S1 is a proper subsequence of S2 (comparing the conversion sequences in
the canonical form defined by 13.3.3.1.1, excluding any Lvalue
Transformation; the identity conversion sequence is considered to be a
subsequence of any non-identity conversion sequence)"


you are perfectly right - very interesting: if you replace char[] by
char*, the template is called! (that's what confused me when I wrote this).

Stefan
Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3733
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
0
2070
by: Arun Bhalla | last post by:
I'm having some inconsistency problems with my deployment project ("Setup") and its custom actions ("Installer"). I'm using Visual Studio .NET 2003 (.NET 1.1, no service pack) on Windows XPSP1. ...
74
4994
by: Michael | last post by:
As if we needed another string reversal question. I have a problem with the following code, that I believe should work. int StringReverse(char* psz) { char *p = psz; char *q = psz +...
2
1464
by: Marty | last post by:
Something strange is happening on my web site since my hosting provider upgraded to Server 2003 a few weeks ago. I use forms authentication in my asp.net application, with essentially the...
0
2204
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". ...
0
1791
by: KeithZ | last post by:
I have created a very simple vb.net web service. It works fine on my local machine and every other machine I have installed it on. For the life of me I cannot get it to work on my production...
0
1336
by: Shannon Broskie | last post by:
I'm posting this here as I first found the issue trying to run a 2.0 Framework app on a 2003 server. Background -------------- We utilize a strong name policy sent to all XP machines using...
1
1395
by: Dan Munk | last post by:
Hello, I have a large project exclusively made up of interfaces (several hundred) that define the business objects used in our system. Heavy inheritance and aggregation are used in the project....
0
1264
by: futnuh | last post by:
I am having exactly the same issue as this poster back in 2005. It's strange behaviour where libraries are being automatically appended to my "additional dependencies". In the following linker...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.