public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35228]  New: template accepting numeric fails with sizeof
@ 2008-02-17  8:42 igodard at pacbell dot net
  2008-02-17  8:45 ` [Bug c++/35228] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: igodard at pacbell dot net @ 2008-02-17  8:42 UTC (permalink / raw)
  To: gcc-bugs

This code:
template<int i>
class foo {
public:
    typedef
    unsigned int unsigned_t;
    typedef
    signed int signed_t;
    };

template<typename T>
class bar {
public:
    typedef
    foo<8>::unsigned_t baz1;
    typedef
    foo<sizeof(T)>::unsigned_t baz2;
    };

bar<int> var;

gets you this:

~/ootbc/personal/ivan$ c++ foo.cc
foo.cc:16: error: type 'foo<sizeof (T)>' is not derived from type 'bar<T>'
foo.cc:16: error: expected ';' before 'baz2'


-- 
           Summary: template accepting numeric fails with sizeof
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net


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


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

* [Bug c++/35228] template accepting numeric fails with sizeof
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
@ 2008-02-17  8:45 ` pinskia at gcc dot gnu dot org
  2008-02-17 21:52 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-17  8:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-02-17 08:44 -------
You forgot the keyword typename as foo<sizeof(T)> is a dependent:
    typedef
    typename  foo<sizeof(T)>::unsigned_t baz2;


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/35228] template accepting numeric fails with sizeof
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
  2008-02-17  8:45 ` [Bug c++/35228] " pinskia at gcc dot gnu dot org
  2008-02-17 21:52 ` manu at gcc dot gnu dot org
@ 2008-02-17 21:52 ` manu at gcc dot gnu dot org
  2008-02-17 21:57 ` [Bug c++/35228] bad error recovery with missing typename manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-17 21:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-17 21:52:13
               date|                            |


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


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

* [Bug c++/35228] template accepting numeric fails with sizeof
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
  2008-02-17  8:45 ` [Bug c++/35228] " pinskia at gcc dot gnu dot org
@ 2008-02-17 21:52 ` manu at gcc dot gnu dot org
  2008-02-17 21:52 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-17 21:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-02-17 21:51 -------
The C++ parser can probably mention 'typename' in the error message.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
           Severity|normal                      |enhancement
             Status|RESOLVED                    |UNCONFIRMED
           Keywords|                            |diagnostic
         Resolution|INVALID                     |


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


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

* [Bug c++/35228] bad error recovery with missing typename
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
                   ` (2 preceding siblings ...)
  2008-02-17 21:52 ` manu at gcc dot gnu dot org
@ 2008-02-17 21:57 ` manu at gcc dot gnu dot org
  2008-02-17 22:00 ` pinskia at gcc dot gnu dot org
  2009-11-08  3:10 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-17 21:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-02-17 21:56 -------
And the message:

foo.cc:16: error: expected ';' before 'baz2'

is just broken. What does

typedef foo<sizeof(T)>::unsigned_t;

is supposed to mean?

It is obvious that something went wrong here.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-02-17 21:52:13         |2008-02-17 21:56:28
               date|                            |
            Summary|template accepting numeric  |bad error recovery with
                   |fails with sizeof           |missing typename


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


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

* [Bug c++/35228] bad error recovery with missing typename
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
                   ` (3 preceding siblings ...)
  2008-02-17 21:57 ` [Bug c++/35228] bad error recovery with missing typename manu at gcc dot gnu dot org
@ 2008-02-17 22:00 ` pinskia at gcc dot gnu dot org
  2009-11-08  3:10 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-02-17 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-02-17 21:59 -------
>  foo<sizeof(T)>::unsigned_t;

Is considered a variable by default.


-- 


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


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

* [Bug c++/35228] bad error recovery with missing typename
  2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
                   ` (4 preceding siblings ...)
  2008-02-17 22:00 ` pinskia at gcc dot gnu dot org
@ 2009-11-08  3:10 ` jason at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-08  3:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jason at gcc dot gnu dot org  2009-11-08 03:10 -------


*** This bug has been marked as a duplicate of 15946 ***


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2009-11-08  3:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-17  8:42 [Bug c++/35228] New: template accepting numeric fails with sizeof igodard at pacbell dot net
2008-02-17  8:45 ` [Bug c++/35228] " pinskia at gcc dot gnu dot org
2008-02-17 21:52 ` manu at gcc dot gnu dot org
2008-02-17 21:52 ` manu at gcc dot gnu dot org
2008-02-17 21:57 ` [Bug c++/35228] bad error recovery with missing typename manu at gcc dot gnu dot org
2008-02-17 22:00 ` pinskia at gcc dot gnu dot org
2009-11-08  3:10 ` jason 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).