Topic: Defect report: Explicit type conversion (functional n.)
Author: "Bill Wade" <bill.wade@stoner.com>
Date: 2000/04/13 Raw View
Beszedes Arpad <beszedes@cc.u-szeged.hu> wrote in message
news:38F30602.8A9A6509@cc.u-szeged.hu...
>
> [ Moderator's note: forwarded to C++ committee -sdc ]
>
> Is this a possible defect in the standard?
>
> Section 5.2.3 discusses the Explicit type conversion (functional
> notation).
> [ ... ]
> However, I believe that there is an inconsistency in this section, 2nd
> paragraph, where saying:
> "... for a non-array complete object type or the (possibly cv-qualified)
> void type..." where the according grammar-fragment does not allow any
> other qualifiers!
template<class T> void foo(T* t)
{
T(0); // As called below, T is (const void)
}
void const* x;
foo(x);
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Beszedes Arpad <beszedes@cc.u-szeged.hu>
Date: 2000/04/11 Raw View
[ Moderator's note: forwarded to C++ committee -sdc ]
Is this a possible defect in the standard?
Section 5.2.3 discusses the Explicit type conversion (functional
notation).
The according grammar fragment is the following:
postfix-expression:
...
simple-type-specifier ( expression-list_opt )
...
Now, this involves that this conversion can either be:
1.) A() where A is a class- typedef- or enum-name or
2.) T() where T is a fundamental type (like int)
But! This does not allows things like:
const int()
Why not? Shouldn't there be allowed multiple simple-type-specifiers as
in the case of decl-specifier-seq?
However, I believe that there is an inconsistency in this section, 2nd
paragraph, where saying:
"... for a non-array complete object type or the (possibly cv-qualified)
void type..." where the according grammar-fragment does not allow any
other qualifiers!
My second question is also related to this topic. Does the same section
involve that the following is illegal?
int *p = int*(); // should initialize to 0
Thanks in advance,
Arpad B.
--
***********************************************
* Arpad Beszedes (research engineer) *
* *
* Research Group on Artificial Intelligence *
* Hungarian Academy of Sciences *
* Attila Jozsef University, Szeged, Hungary *
* e-mail: beszedes@cc.u-szeged.hu *
* tel.: (+36) 62/544-145 *
***********************************************
* "To err is human, but to really mess things *
* up you need a computer." *
***********************************************
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]