473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

using declaration and ADL

Is it true that ADL will be done even in the presence of a using declaration
as someone said recently at comp.lang.c++.moderated?

Fraser.
Sep 9 '05 #1
5 1277

"Fraser Ross" <f@ross.co.uk> wrote in message
news:1126269243.deec083132f347999d85f524c3edde0a@t eranews...
Is it true that ADL will be done even in the presence of a using
declaration
as someone said recently at comp.lang.c++.moderated?


That's not much info to go on. I had to go look up what ADL meant:
argument-dependent lookup. That still doesn't tell me the context of what
you're discussing, or why it matters.

(Please tell me you're not arguing about this with mister Hatton. If so,
give it up. You'll never resolve anything.)

-Howard
Sep 9 '05 #2
From the moderated group:
This is an error of your compiler (I know, it's a g++ :) ). And I
think, that Wolfgang's wrong, using declaration can not stop ADL
lookup. In this
example g++ can find both functions (and that's right) and it's an
ambiguity:

namespace N
{
struct A;
}

namespace Odd
{
void fun(N::A&)
{
}
}

namespace N
{
struct A{};

void fun(A&)
{
}
}

int main()
{
using Odd::fun;
N::A a;
fun(a);
}

End quote.

There is not a reference to a paragraph in the standard. I will be doubtful
until I see one.

Fraser.
Sep 9 '05 #3
Fraser Ross wrote:
From the moderated group:
This is an error of your compiler (I know, it's a g++ :) ). And I
think, that Wolfgang's wrong, using declaration can not stop ADL
lookup. In this
example g++ can find both functions (and that's right) and it's an
ambiguity:

namespace N
{
struct A;
}

namespace Odd
{
void fun(N::A&)
{
}
}

namespace N
{
struct A{};

void fun(A&)
{
}
}

int main()
{
using Odd::fun;
N::A a;
fun(a);
}

End quote.

There is not a reference to a paragraph in the standard. I will be doubtful
until I see one.


3.4.2/2a. "Otherwise the set of declarations found by the lookup of the
function name is the union..."

Regular unqualified lookup should find 'Odd::fun' and argument-dependent
lookup adds 'N::fun' to the set, causing ambiguity.

V
Sep 9 '05 #4

"Victor Bazarov"
3.4.2/2a. "Otherwise the set of declarations found by the lookup of the
function name is the union..."

Regular unqualified lookup should find 'Odd::fun' and argument-dependent
lookup adds 'N::fun' to the set, causing ambiguity.


Thats not referring to using declarations. The section I wanted to see must
be 7.3.3/12.

Fraser.
Sep 9 '05 #5
Fraser Ross wrote:
"Victor Bazarov"
3.4.2/2a. "Otherwise the set of declarations found by the lookup of the
function name is the union..."

Regular unqualified lookup should find 'Odd::fun' and argument-dependent
lookup adds 'N::fun' to the set, causing ambiguity.

Thats not referring to using declarations. The section I wanted to see must
be 7.3.3/12.


I thought that went without saying. The difference is really in ADL
itself, IMO. The main thing is that if a _member_ function is found,
other scopes are not considered for ADL. Now, with regular names (non-
members) all scopes are considered and all names are bundled for overload
resolution purposes.

V
Sep 9 '05 #6

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

Similar topics

1
by: Ken Larson | last post by:
I have a question about using XSL to extract information from an SVG (XML) file that has a DOCTYPE/DTD declaration. I am able to do this successfully if I write my own SVG files without such a...
10
by: Christopher Benson-Manica | last post by:
Why can't I use a class destructor in a using declaration: using MyClass::~MyClass; ? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org ...
4
by: marco_segurini | last post by:
Hi, the following test program shows a solution to a problem I have had. Now, this test program is compiled and linked by VS2003 and g++ while Comeau-on-line-compiler fails with this messages:...
5
by: John Gabriele | last post by:
I'm hoping someone can please help me remember the C++ rule: When you're writing a header file for a class (say, some_namespace::Bar), and that class makes use of another class...
3
by: Dan | last post by:
Is there a better way to include the XML declaration than the following? XmlDeclaration dec =m_XMLDocument.CreateXmlDeclaration("1.0",string.Empty, "yes");...
3
by: pyramus | last post by:
I am wondering which one should be preferred for creating a local synonym within a function definition. Let's say I have a type in my library called MyLib::Foundation::int32, which I can't stand...
13
by: Kantha | last post by:
Hi all, I have declared an Union as follows typedef union { struct interrupt_bits { unsigned char c_int_hs_fs_status : 1, c_setup_intflag : 1,
0
by: ivan.leben | last post by:
I am writing this in a new thread to alert that I found a solution to the problem mentioned here: http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7970afaa089fd5b8 and to avoid...
7
by: =?Utf-8?B?QmVu?= | last post by:
Hi, I sometimes see code where the 'using' statements at the top of the file are located before the namespace declaration, and sometimes they are located inside it. For example: using...
6
by: kluge.wolfram | last post by:
Hi, i get stucked on a transformation problem using XSLT. What i need is to copy an XML Tree to an output XML without any automatic changes. Since i used <xsl:copyor <xsl:copy-ofthere occur...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.