public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33516]  New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
@ 2007-09-21  8:50 rguenth at gcc dot gnu dot org
  2007-09-21  8:56 ` [Bug c++/33516] " rguenth at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-21  8:50 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

struct foo_bar;

typedef foo_bar bar;

struct foo_bar {
         typedef int     baz;
         bar::baz   ii;   
};

t.C:7: error: ‘baz’ in class ‘bar’ does not name a type

or as originally reported:

struct foo_bar;

namespace foo {
         typedef foo_bar bar;
};

struct foo_bar {
         typedef int     baz;
         foo::bar::baz   ii;
};

t.C:9: error: ‘baz’ in class ‘foo::bar’ does not name a type

moving the declaration of ii out of foo_bar, the code is accepted:

struct foo_bar;

typedef foo_bar bar;

struct foo_bar {
         typedef int     baz;
};

bar::baz   ii;


EDG happily accepts the code in strict-ansi mode.


-- 
           Summary: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified
                    name-lookup
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug c++/33516] [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
@ 2007-09-21  8:56 ` rguenth at gcc dot gnu dot org
  2007-09-22  4:14 ` bangerth at dealii dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-21  8:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-09-21 08:56 -------
What I can find that supports rejecting the code is:

3.4.3(1) "Qualified name lookup":

"If the name found is not a class-name (clause 9) or namespace-name 
(7.3.1), the program is ill-formed."

7.1.3 "The typedef specifier" it says:

"A name declared with the typedef specifier becomes a typedef-name."

but then the last example should be rejected as well?


-- 


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


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

* [Bug c++/33516] [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
  2007-09-21  8:56 ` [Bug c++/33516] " rguenth at gcc dot gnu dot org
@ 2007-09-22  4:14 ` bangerth at dealii dot org
  2007-09-22  8:00 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2007-09-22  4:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at dealii dot org  2007-09-22 04:14 -------
(In reply to comment #1)
> What I can find that supports rejecting the code is:
> 
> 3.4.3(1) "Qualified name lookup":
> 
> "If the name found is not a class-name (clause 9) or namespace-name 
> (7.3.1), the program is ill-formed."
> 
> 7.1.3 "The typedef specifier" it says:
> 
> "A name declared with the typedef specifier becomes a typedef-name."
> 
> but then the last example should be rejected as well?

I think this isn't the problem you run into. The real problem with the
typedef is that if you use typedef_name::nested_name from within the
class that typedef_name points to, then typedef_name is still an incomplete
type because you haven't reached the closing brace yet. In your last
example, you *have* reached the closing brace and the pointed class is
complete so using typedef_name::nested_name succeeds.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org


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


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

* [Bug c++/33516] [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
  2007-09-21  8:56 ` [Bug c++/33516] " rguenth at gcc dot gnu dot org
  2007-09-22  4:14 ` bangerth at dealii dot org
@ 2007-09-22  8:00 ` rguenth at gcc dot gnu dot org
  2007-09-22  8:01 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-22  8:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-09-22 07:59 -------
Yes, this is what debugging cc1plus reveals - the typedef-name type decl is
still
incomplete.  Now, the question is if this is valid C++ or not ;)  Using
foo_bar instead of bar works as well (though foo_bar also is incomplete).


-- 


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


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

* [Bug c++/33516] [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-09-22  8:00 ` rguenth at gcc dot gnu dot org
@ 2007-09-22  8:01 ` rguenth at gcc dot gnu dot org
  2007-09-26 19:08 ` [Bug c++/33516] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-09-22  8:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2007-09-22 08:00 -------
That is the following:

struct foo_bar;

typedef foo_bar bar;

struct foo_bar {
         typedef int     baz;
         foo_bar::baz   ii;
};

is fine.


-- 


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


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

* [Bug c++/33516] [4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-09-22  8:01 ` rguenth at gcc dot gnu dot org
@ 2007-09-26 19:08 ` pinskia at gcc dot gnu dot org
  2007-09-28  4:13 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-09-26 19:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.1/4.2/4.3 Regression]
                   |Rejects typedef qualified   |Rejects typedef qualified
                   |name-lookup                 |name-lookup
   Target Milestone|---                         |4.1.3


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


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

* [Bug c++/33516] [4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-09-26 19:08 ` [Bug c++/33516] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
@ 2007-09-28  4:13 ` mmitchel at gcc dot gnu dot org
  2007-10-31 10:25 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-09-28  4:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2007-09-28 04:13 -------
I believe these cases to be valid.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/33516] [4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-09-28  4:13 ` mmitchel at gcc dot gnu dot org
@ 2007-10-31 10:25 ` jakub at gcc dot gnu dot org
  2007-11-02 21:37 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-10-31 10:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2007-10-31 10:25 -------
Testing a patch.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-10-31 10:25:15
               date|                            |


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


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

* [Bug c++/33516] [4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-10-31 10:25 ` jakub at gcc dot gnu dot org
@ 2007-11-02 21:37 ` jakub at gcc dot gnu dot org
  2007-11-02 21:40 ` [Bug c++/33516] [4.1/4.2 " jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-02 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2007-11-02 21:37 -------
Subject: Bug 33516

Author: jakub
Date: Fri Nov  2 21:37:35 2007
New Revision: 129862

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129862
Log:
        PR c++/33516
        * parser.c (cp_parser_nested_name_specifier_opt): Use
        TYPE_MAIN_VARIANT (new_scope) as scope if new_scope is an incomplete
        typedef of currently open class.

        * g++.dg/lookup/typedef1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/lookup/typedef1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/33516] [4.1/4.2 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-11-02 21:37 ` jakub at gcc dot gnu dot org
@ 2007-11-02 21:40 ` jakub at gcc dot gnu dot org
  2008-07-04 22:18 ` [Bug c++/33516] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 22:26 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-02 21:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2007-11-02 21:40 -------
Fixed on the trunk so far.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.0.0 4.1.2 4.2.1 4.3.0     |4.0.0 4.1.2 4.2.1
      Known to work|3.4.6                       |3.4.6 4.3.0
            Summary|[4.1/4.2/4.3 Regression]    |[4.1/4.2 Regression] Rejects
                   |Rejects typedef qualified   |typedef qualified name-
                   |name-lookup                 |lookup


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


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

* [Bug c++/33516] [4.2 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-11-02 21:40 ` [Bug c++/33516] [4.1/4.2 " jakub at gcc dot gnu dot org
@ 2008-07-04 22:18 ` jsm28 at gcc dot gnu dot org
  2009-03-30 22:26 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2008-07-04 22:17 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression] Rejects|[4.2 Regression] Rejects
                   |typedef qualified name-     |typedef qualified name-
                   |lookup                      |lookup
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/33516] [4.2 Regression] Rejects typedef qualified name-lookup
  2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-07-04 22:18 ` [Bug c++/33516] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 22:26 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 22:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jsm28 at gcc dot gnu dot org  2009-03-30 22:26 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|4.0.0 4.1.2 4.2.1           |4.0.0 4.1.2 4.2.1 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 22:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-21  8:50 [Bug c++/33516] New: [4.0/4.1/4.2/4.3 Regression] Rejects typedef qualified name-lookup rguenth at gcc dot gnu dot org
2007-09-21  8:56 ` [Bug c++/33516] " rguenth at gcc dot gnu dot org
2007-09-22  4:14 ` bangerth at dealii dot org
2007-09-22  8:00 ` rguenth at gcc dot gnu dot org
2007-09-22  8:01 ` rguenth at gcc dot gnu dot org
2007-09-26 19:08 ` [Bug c++/33516] [4.1/4.2/4.3 " pinskia at gcc dot gnu dot org
2007-09-28  4:13 ` mmitchel at gcc dot gnu dot org
2007-10-31 10:25 ` jakub at gcc dot gnu dot org
2007-11-02 21:37 ` jakub at gcc dot gnu dot org
2007-11-02 21:40 ` [Bug c++/33516] [4.1/4.2 " jakub at gcc dot gnu dot org
2008-07-04 22:18 ` [Bug c++/33516] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 22:26 ` jsm28 at gcc dot gnu dot 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).