public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
@ 2007-02-17 20:02 ` pinskia at gcc dot gnu dot org
  2007-08-12  2:05 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-17 20:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-02-17 20:02 -------
*** Bug 30837 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
  2007-02-17 20:02 ` [Bug c++/6709] typeof() cannot be used with the :: operator pinskia at gcc dot gnu dot org
@ 2007-08-12  2:05 ` pinskia at gcc dot gnu dot org
  2010-03-08 14:29 ` bangerth at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-12  2:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2007-08-12 02:05 -------
Hmm, I wonder what the current draft of C++0x says of decltype with this
respect (right now we reject it).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
  2007-02-17 20:02 ` [Bug c++/6709] typeof() cannot be used with the :: operator pinskia at gcc dot gnu dot org
  2007-08-12  2:05 ` pinskia at gcc dot gnu dot org
@ 2010-03-08 14:29 ` bangerth at gmail dot com
  2010-03-08 14:40 ` redi at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: bangerth at gmail dot com @ 2010-03-08 14:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from bangerth at gmail dot com  2010-03-08 14:29 -------
*** Bug 43285 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-03-08 14:29 ` bangerth at gmail dot com
@ 2010-03-08 14:40 ` redi at gcc dot gnu dot org
  2010-03-08 14:46 ` redi at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-03-08 14:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from redi at gcc dot gnu dot org  2010-03-08 14:40 -------
(In reply to comment #8)
> Hmm, I wonder what the current draft of C++0x says of decltype with this
> respect (right now we reject it).
> 

In Bug 43285 Comment 1 I said that I think decltype is invalid in this context,
which would make this a documentation bug for C++.

In the C++0x grammar:

simple-type-specifier:
  ::_opt nested-name-specifier_opt type-name
  ...
  decltype ( expression )

nested-name-specifier:
  type-name ::
  namespace-name ::
  nested-name-specifier identifier ::
  nested-name-specifier template_opt simple-template-id ::

type-name:
  class-name
  enum-name
  typedef-name

So decltype(expression) cannot appear in a nested-name-specifier


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2010-03-08 14:40 ` redi at gcc dot gnu dot org
@ 2010-03-08 14:46 ` redi at gcc dot gnu dot org
  2010-03-08 16:00 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-03-08 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from redi at gcc dot gnu dot org  2010-03-08 14:46 -------
(In reply to comment #4)
> Just noticed this bug myself.  You can work around it by creating
> a temporary typedef.  E.g.,
> 
>   typedef typeof(obj) T;
>   T::size_type s;
> 
> Still annoying though.

This workaround is required for decltype, I don't see why typeof should be any
different.

The reason is that decltype(obj) doesn't declare a new type-name, it is only a
simple-type-specifier, which cannot appear in a nested-name-specifier.

The typedef workaround introduces a new type-name, which is allowed in a
nested-name-specifier.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2010-03-08 14:46 ` redi at gcc dot gnu dot org
@ 2010-03-08 16:00 ` manu at gcc dot gnu dot org
  2010-03-08 16:10 ` [Bug c++/6709] [DR743] " redi at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-03-08 16:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from manu at gcc dot gnu dot org  2010-03-08 15:59 -------
*** Bug 43285 has been marked as a duplicate of this bug. ***


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] typeof() cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2010-03-08 16:00 ` manu at gcc dot gnu dot org
@ 2010-03-08 16:10 ` redi at gcc dot gnu dot org
  2010-04-18  6:48 ` [Bug c++/6709] [DR743] decltype " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-03-08 16:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from redi at gcc dot gnu dot org  2010-03-08 16:10 -------
the decltype issue is
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#743

the proposed change is in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3031.pdf

suspending ...


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED
            Summary|typeof() cannot be used with|[DR743] typeof() cannot be
                   |the :: operator             |used with the :: operator


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2010-03-08 16:10 ` [Bug c++/6709] [DR743] " redi at gcc dot gnu dot org
@ 2010-04-18  6:48 ` pinskia at gcc dot gnu dot org
  2010-04-18 12:56 ` faisalv at yahoo dot com
  2010-04-19  9:38 ` redi at gcc dot gnu dot org
  9 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-04-18  6:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from pinskia at gcc dot gnu dot org  2010-04-18 06:48 -------
*** Bug 43780 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |faisalv at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-04-18  6:48 ` [Bug c++/6709] [DR743] decltype " pinskia at gcc dot gnu dot org
@ 2010-04-18 12:56 ` faisalv at yahoo dot com
  2010-04-19  9:38 ` redi at gcc dot gnu dot org
  9 siblings, 0 replies; 14+ messages in thread
From: faisalv at yahoo dot com @ 2010-04-18 12:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from faisalv at yahoo dot com  2010-04-18 12:56 -------
I had (In reply to comment #14)
> *** Bug 43780 has been marked as a duplicate of this bug. ***
> 

The DR 743 has been voted into FCD (CD2) - shouldn't this be unsuspended?
thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2010-04-18 12:56 ` faisalv at yahoo dot com
@ 2010-04-19  9:38 ` redi at gcc dot gnu dot org
  9 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-04-19  9:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from redi at gcc dot gnu dot org  2010-04-19 09:38 -------
Unsuspending, DR743 was recently resolved


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW
   Last reconfirmed|2009-04-16 18:10:10         |2010-04-19 09:38:32
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-07-20 14:25 ` jason at gcc dot gnu.org
@ 2011-07-22 21:25 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-22 21:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.7.0

--- Comment #20 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-22 21:24:35 UTC ---
Implemented for 4.7.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-4@http.gcc.gnu.org/bugzilla/>
  2011-01-20 22:53 ` dev.lists at jessamine dot co.uk
  2011-04-06 14:24 ` osa252 at mail dot ru
@ 2011-07-20 14:25 ` jason at gcc dot gnu.org
  2011-07-22 21:25 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 14+ messages in thread
From: jason at gcc dot gnu.org @ 2011-07-20 14:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709

--- Comment #19 from Jason Merrill <jason at gcc dot gnu.org> 2011-07-20 14:21:09 UTC ---
Author: jason
Date: Wed Jul 20 14:21:05 2011
New Revision: 176513

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176513
Log:
    PR c++/6709 (DR 743)
    PR c++/42603 (DR 950)
gcc/cp/
    * parser.c (token_is_decltype, cp_lexer_next_token_is_decltype): New.
    (cp_parser_nested_name_specifier_opt): Allow decltype.
    (cp_parser_qualifying_entity): Likewise.
    (cp_parser_decltype): Replace source tokens with CPP_DECLTYPE.
    (cp_parser_simple_type_specifier): Handle decltype as scope.
    (cp_parser_base_specifier): Allow decltype.
    (cp_parser_base_clause): Don't crash on null base.
    * parser.h (CPP_KEYWORD, CPP_TEMPLATE_ID): Move to c-common.h.
    (CPP_NESTED_NAME_SPECIFIER, N_CP_TTYPES): Likewise.
gcc/c-family/
    * c-common.h (CPP_KEYWORD, CPP_TEMPLATE_ID): Move from cp/parser.h.
    (CPP_NESTED_NAME_SPECIFIER, N_CP_TTYPES): Likewise.
    (CPP_DECLTYPE): New.
    * c-common.c (c_parse_error): Handle CPP_DECLTYPE.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype21.C
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/parser.h
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-4@http.gcc.gnu.org/bugzilla/>
  2011-01-20 22:53 ` dev.lists at jessamine dot co.uk
@ 2011-04-06 14:24 ` osa252 at mail dot ru
  2011-07-20 14:25 ` jason at gcc dot gnu.org
  2011-07-22 21:25 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 14+ messages in thread
From: osa252 at mail dot ru @ 2011-04-06 14:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709

cheburnae <osa252 at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |osa252 at mail dot ru

--- Comment #18 from cheburnae <osa252 at mail dot ru> 2011-04-06 14:23:53 UTC ---
A simple workaround:

template <class T>
struct TypeEcho {
    typedef T R;
};

#define TYPE_OF(expr) TypeEcho<typeof (*&expr)>::R

template <class T>
void foo() {
    typename TYPE_OF(std::vector<T>())::value_type();
}

void foo2() {
    TYPE_OF(std::vector<int>())::value_type();
    foo<int>();
}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug c++/6709] [DR743] decltype cannot be used with the :: operator
       [not found] <bug-6709-4@http.gcc.gnu.org/bugzilla/>
@ 2011-01-20 22:53 ` dev.lists at jessamine dot co.uk
  2011-04-06 14:24 ` osa252 at mail dot ru
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: dev.lists at jessamine dot co.uk @ 2011-01-20 22:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6709

Adam Butcher <dev.lists at jessamine dot co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dev.lists at jessamine dot
                   |                            |co.uk

--- Comment #17 from Adam Butcher <dev.lists at jessamine dot co.uk> 2011-01-20 22:03:31 UTC ---
I have the beginnings of a fix for this (see the patch at
http://gcc.gnu.org/ml/gcc-patches/2011-01/msg01392.html); currently there is a
bug with my impl where any name on the right of `decltype(x)::' at the front of
a nested-name-specifier is considered a non-type unless qualified with
typename.

I.e. given:

   struct X { typedef int I; }
   X x;

instead of:

   decltype(x)::I i = 7;

the user must currently write:

   typename decltype(x)::I i = 7;

as if decltype(x) was somehow dependent on a template parameter -- which it
obviously isn't as there is no template it sight.

Otherwise the patch seems close.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-07-22 21:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-6709-3116@http.gcc.gnu.org/bugzilla/>
2007-02-17 20:02 ` [Bug c++/6709] typeof() cannot be used with the :: operator pinskia at gcc dot gnu dot org
2007-08-12  2:05 ` pinskia at gcc dot gnu dot org
2010-03-08 14:29 ` bangerth at gmail dot com
2010-03-08 14:40 ` redi at gcc dot gnu dot org
2010-03-08 14:46 ` redi at gcc dot gnu dot org
2010-03-08 16:00 ` manu at gcc dot gnu dot org
2010-03-08 16:10 ` [Bug c++/6709] [DR743] " redi at gcc dot gnu dot org
2010-04-18  6:48 ` [Bug c++/6709] [DR743] decltype " pinskia at gcc dot gnu dot org
2010-04-18 12:56 ` faisalv at yahoo dot com
2010-04-19  9:38 ` redi at gcc dot gnu dot org
     [not found] <bug-6709-4@http.gcc.gnu.org/bugzilla/>
2011-01-20 22:53 ` dev.lists at jessamine dot co.uk
2011-04-06 14:24 ` osa252 at mail dot ru
2011-07-20 14:25 ` jason at gcc dot gnu.org
2011-07-22 21:25 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).