Topic: 3.4.5: qualified pseudodestructor call lookup rules fail
Author: krixel@qed.pl ("Krzysztof elechowski")
Date: Tue, 24 Jan 2006 15:42:18 GMT Raw View
Please explain whether the following code is ill-formed:
typedef char T;
void fun(T &p_t) {
p_t.T::~T();
}
Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++
In strict mode, with -tused, Compile succeeded
My reasoning goes as follows:
We have to lookup for T in the context of p_t.T by 3.4.3/5 . We have the
following choices by 3.4.5:
1. p_t is not of class type. N/A.
2. p_t is not of class type and is not a pointer to a scalar type. N/A.
3. T is not preceded by ~ and T::~T is qualified. N/A.
4. If T is a class-name-or-namespace-name. How can we tell? We have to
look it up to know what it is. It is a circular definition.
Assuming we could use some fixpoint logic to resolve this, there is no way
for T to be one. N/A.
5. T is not preceded by ::. N/A.
6. T is not followed by <. N/A.
7. T is not preceded by operator keyword (BTW a link to 12.3.2 is needed
here). N/A.
I am stuck.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: william.m.miller@gmail.com
Date: Thu, 26 Jan 2006 11:23:43 CST Raw View
"Krzysztof elechowski" wrote:
> Please explain whether the following code is ill-formed:
>
> typedef char T;
>
> void fun(T &p_t) {
> p_t.T::~T();
> }
>
> My reasoning goes as follows:
> We have to lookup for T in the context of p_t.T by 3.4.3/5 . We have the
> following choices by 3.4.5:
> 1. p_t is not of class type. N/A.
> 2. p_t is not of class type and is not a pointer to a scalar type. N/A.
> 3. T is not preceded by ~ and T::~T is qualified. N/A.
> 4. If T is a class-name-or-namespace-name. How can we tell? We have to
> look it up to know what it is. It is a circular definition.
> Assuming we could use some fixpoint logic to resolve this, there is no way
> for T to be one. N/A.
> 5. T is not preceded by ::. N/A.
> 6. T is not followed by <. N/A.
> 7. T is not preceded by operator keyword (BTW a link to 12.3.2 is needed
> here). N/A.
> I am stuck.
The intent is that T in this example is looked up by an ordinary
lexical-scope lookup in the context of the complete postfix-expression.
However, you are right that the Standard does not contain a coherent
description of how this case (as well as a number of others with
respect to destructor and pseudo-destructor name lookup) is to be
handled. (See core language issues 244, 305, and 399, in particular.)
I'll open another issue for this case. Thanks for pointing it out.
-- William M. (Mike) Miller
Edison Design Group
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]