Topic: declarator-id syntax question


Author: Michael Spencer <michael_spencer@btclick.com>
Date: Mon, 11 Jun 2001 20:53:51 GMT
Raw View
Kiril Avdeiv wrote:
>
> Can anyone come up with an example where a declarator-id is:
>   ::opt nested-name-specifieropt type-name
> ?
>

It's to allow for the declaration of constructors:

 class A
 {
    A ();
 };

You can't specify a constructor in an expression, so a constructor
isn't an id-expression.

But I think class-name instead of type-name here would make the
grammar clearer.

Mike
--
http://www.lazycplusplus.com

---
[ 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.research.att.com/~austern/csc/faq.html                ]





Author: kavdeiv@mail.ru (Kiril Avdeiv)
Date: Mon, 11 Jun 2001 18:26:53 GMT
Raw View
Hi everyone,

The standard provides the following syntax for a declarator-id.

declarator-id:
   id-expression
   ::opt nested-name-specifieropt type-name

While I can easily understand the first choice I cannot think of an
example where the second choice is used.

Can anyone come up with an example where a declarator-id is:
  ::opt nested-name-specifieropt type-name
?

Maybe I don't realize something, but this doesn't make sense to me.

Thanks very much
Kiril

---
[ 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.research.att.com/~austern/csc/faq.html                ]