[Bug c++/30734] New: name conflict between class and namespace name is not recognized

2007-02-08 Thread ulrich dot lauther at siemens dot com
1  namespace Foo {
   2  };
   3  
   4  class Foo {
   5  };
   6  
   7  int main() {
   8class Foo1 : public Foo {
   9};
  10Foo1 my_Foo1; 
  11Foo my_foo;
  12return 0;
  13  }
  14  
  15  
Foo.C: In function 'int main()':
Foo.C:11: error: expected primary-expression before 'my_foo'
Foo.C:11: error: expected `;' before 'my_foo'

on line 8 and 10, Foo is understod asa class name, on line 11 as a namespace
Without line 11, no error message at all


-- 
   Summary: name conflict between class and namespace name is not
recognized
   Product: gcc
   Version: 4.1.1
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ulrich dot lauther at siemens dot com
 GCC build triplet: 686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: 686-pc-linux-gnu


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



Re: [Bug c++/30734] New: name conflict between class and namespace name is not recognized

2007-02-08 Thread Gabriel Dos Reis
ulrich dot lauther at siemens dot com [EMAIL PROTECTED] writes:

| 1  namespace Foo {
|2  };
|3  
|4  class Foo {
|5  };
|6  
|7  int main() {
|8class Foo1 : public Foo {
|9};
|   10Foo1 my_Foo1; 
|   11Foo my_foo;
|   12return 0;
|   13  }
|   14  
|   15  
| Foo.C: In function 'int main()':
| Foo.C:11: error: expected primary-expression before 'my_foo'
| Foo.C:11: error: expected `;' before 'my_foo'
| 
| on line 8 and 10, Foo is understod asa class name, on line 11 as a namespace
| Without line 11, no error message at all

Line 4 is invalid; the front-end should have issued a diagnostic there.

-- Gaby