public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15179] New: Bad error message
@ 2004-04-27 20:40 igodard at pacbell dot net
  2004-04-27 20:47 ` [Bug c++/15179] " igodard at pacbell dot net
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: igodard at pacbell dot net @ 2004-04-27 20:40 UTC (permalink / raw)
  To: gcc-bugs

The actual problem is a missing "typename" on the reported line, but you'd never figure that out from the message.

-- 
           Summary: Bad error message
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
@ 2004-04-27 20:47 ` igodard at pacbell dot net
  2004-04-27 20:48 ` igodard at pacbell dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: igodard at pacbell dot net @ 2004-04-27 20:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2004-04-27 20:31 -------
Created an attachment (id=6176)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6176&action=view)
Source code


-- 


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
  2004-04-27 20:47 ` [Bug c++/15179] " igodard at pacbell dot net
@ 2004-04-27 20:48 ` igodard at pacbell dot net
  2004-04-27 20:53 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: igodard at pacbell dot net @ 2004-04-27 20:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2004-04-27 20:32 -------
Created an attachment (id=6177)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6177&action=view)
Compiler output (-v -save-temps)


-- 


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
  2004-04-27 20:47 ` [Bug c++/15179] " igodard at pacbell dot net
  2004-04-27 20:48 ` igodard at pacbell dot net
@ 2004-04-27 20:53 ` pinskia at gcc dot gnu dot org
  2004-04-27 21:05 ` igodard at pacbell dot net
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 20:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 20:40 -------
Fixed for 3.4.0 which is out:
In file included from testPowerset.cc:5:
/home/ivan/ootbc/common/include/powerset.hh:112: error: type `Powerset<E>' is not derived from 
type `Powerset<E>::iterator'
/home/ivan/ootbc/common/include/powerset.hh:112: error: ISO C++ forbids declaration of 
`difference_type' with no type
/home/ivan/ootbc/common/include/powerset.hh:112: error: expected `;' before "difference_type"

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |diagnostic
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2004-04-27 20:53 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 21:05 ` igodard at pacbell dot net
  2004-04-27 21:40 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: igodard at pacbell dot net @ 2004-04-27 21:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2004-04-27 20:59 -------
The "fixed" note just repeats the same error message I'm complaining about on 3.3. How about a message "Use of type from enclosing template class requires 'typename'" or similar? What in the compiler is thinking that "Powerset<E>" needs to be derived from `Powerset<E>::iterator', anyway? There are no base classes or derivations here - I call it confusing and probably indicating a lost compiler.

Ivan

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2004-04-27 21:05 ` igodard at pacbell dot net
@ 2004-04-27 21:40 ` pinskia at gcc dot gnu dot org
  2004-04-27 22:26 ` igodard at pacbell dot net
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 21:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 21:05 -------
/home/ivan/ootbc/common/include/powerset.hh:112: error: type `Powerset<E>' is not derived from 
type `Powerset<E>::iterator'

The error message is correct.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (4 preceding siblings ...)
  2004-04-27 21:40 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 22:26 ` igodard at pacbell dot net
  2004-04-27 22:45 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: igodard at pacbell dot net @ 2004-04-27 22:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From igodard at pacbell dot net  2004-04-27 22:11 -------
Come on! The error message is certainly *true*, but *correct* means that it diagnoses the actual error that is present and helps the user toward a correction. This message certainly does neither. The actual error is a missing "typename". Taken at face value, the message suggests that 'Powerset<E> should be derived from its local type "Powerset<E>::iterator", but it is impossible for a class to derive from one of its own local types. 

You may argue that the problem is low priority, but "correct" it ain't. Take it up with your associates.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug c++/15179] Bad error message
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (5 preceding siblings ...)
  2004-04-27 22:26 ` igodard at pacbell dot net
@ 2004-04-27 22:45 ` pinskia at gcc dot gnu dot org
  2004-04-27 22:49 ` [Bug c++/15179] [3.4/3.5 Regression] Rejects typedef of a type of an outerclass pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 22:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 22:28 -------
Confirmed after looking at the code again I think this is valid as iterator is an inner class 
and Type is just the outter class, reduced testcase:
template<class E>
class Powerset {
 typedef Powerset<E> Type;
 typedef int difference_type;
  class iterator
  {
    typedef Type::difference_type  difference_type;
  };
};


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|diagnostic                  |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-27 22:28:17
               date|                            |
   Target Milestone|3.4.0                       |---
            Version|3.3.3                       |3.4.0


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


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

* [Bug c++/15179] [3.4/3.5 Regression] Rejects typedef of a type of an outerclass
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (6 preceding siblings ...)
  2004-04-27 22:45 ` pinskia at gcc dot gnu dot org
@ 2004-04-27 22:49 ` pinskia at gcc dot gnu dot org
  2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 22:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Bad error message           |[3.4/3.5 Regression] Rejects
                   |                            |typedef of a type of an
                   |                            |outerclass
   Target Milestone|---                         |3.4.1


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (7 preceding siblings ...)
  2004-04-27 22:49 ` [Bug c++/15179] [3.4/3.5 Regression] Rejects typedef of a type of an outerclass pinskia at gcc dot gnu dot org
@ 2004-04-27 23:18 ` pinskia at gcc dot gnu dot org
  2004-04-28  1:02 ` bangerth at dealii dot org
  2004-08-05 11:25 ` redi at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-27 23:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-27 22:56 -------
Lets keep this for the error message, because PR 9634 is the bug which talks about this 
being not a bug but the standard is not clear.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|rejects-valid               |diagnostic
            Summary|[3.4/3.5 Regression] Rejects|Error message can be
                   |typedef of a type of an     |improved
                   |outerclass                  |
   Target Milestone|3.4.1                       |---


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (8 preceding siblings ...)
  2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
@ 2004-04-28  1:02 ` bangerth at dealii dot org
  2004-08-05 11:25 ` redi at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-04-28  1:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-28 00:00 -------
Confirmed. For this code 
----------- 
template <class T> class O { 
    typedef O<T> Type; 
    typedef int inner; 
    class I 
    { 
        typedef Type::inner inner; 
    }; 
}; 
----------- 
gcc produces 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc:6: error: type `O<T>' is not derived from type `O<T>::I' 
x.cc:6: error: ISO C++ forbids declaration of `inner' with no type 
x.cc:6: error: expected `;' before "inner" 
 
which is indeed confusing. (icc, for reference, simply accepts the code 
even with -Xc -ansi -- which is probably wrong.) 
 
Frankly, I have no clue what path in the compiler we are taking to get 
to this error message... 
 
W. 

-- 


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


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

* [Bug c++/15179] Error message can be improved
  2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
                   ` (9 preceding siblings ...)
  2004-04-28  1:02 ` bangerth at dealii dot org
@ 2004-08-05 11:25 ` redi at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu dot org @ 2004-08-05 11:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From redi at gcc dot gnu dot org  2004-08-05 11:24 -------
It doesn't need to involve nested classes either:
-----------------------------
template <bool>
struct A {
    typedef int type;
};

template <bool yn>
struct B {
    typedef A<yn>::type Type;
};
-----------------------------
3.4 and mainline give:
bug.cc:8: error: type `A<<anonymous> >' is not derived from type `B<yn>'
bug.cc:8: error: ISO C++ forbids declaration of `type' with no type
bug.cc:8: error: expected `;' before "Type"

Again, the problem is a missing "typename" but you can't guess that from the
diagnostic. Compiling the same code with GCC 3.3 gives the "implicit typename
is deprecated" warning which makes the error much easier to find, therefore I
consider this a regression against 3.3


-- 


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


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

end of thread, other threads:[~2004-08-05 11:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 20:40 [Bug c++/15179] New: Bad error message igodard at pacbell dot net
2004-04-27 20:47 ` [Bug c++/15179] " igodard at pacbell dot net
2004-04-27 20:48 ` igodard at pacbell dot net
2004-04-27 20:53 ` pinskia at gcc dot gnu dot org
2004-04-27 21:05 ` igodard at pacbell dot net
2004-04-27 21:40 ` pinskia at gcc dot gnu dot org
2004-04-27 22:26 ` igodard at pacbell dot net
2004-04-27 22:45 ` pinskia at gcc dot gnu dot org
2004-04-27 22:49 ` [Bug c++/15179] [3.4/3.5 Regression] Rejects typedef of a type of an outerclass pinskia at gcc dot gnu dot org
2004-04-27 23:18 ` [Bug c++/15179] Error message can be improved pinskia at gcc dot gnu dot org
2004-04-28  1:02 ` bangerth at dealii dot org
2004-08-05 11:25 ` redi 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).