public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* typeof(obj)::size_type doesn't work
@ 2003-11-22 23:13 Haakon Riiser
  0 siblings, 0 replies; only message in thread
From: Haakon Riiser @ 2003-11-22 23:13 UTC (permalink / raw)
  To: gcc-help

I don't know if this is a bug or not, so I'll ask here before I
submit it to GCC Bugzilla:

  $ cat test.cpp
  /****************************************************************/
  #include <vector>
  
  int main()
  {
      std::vector<int> v;
      typeof(v)::size_type s;
  }
  /****************************************************************/

  $ g++ test.cpp
  test.cpp: In function `int main()':
  test.cpp:7: syntax error before `;' token

If I replace

  typeof(v)::size_type s;

with

  typedef typeof(v) vtype;
  vtype::size_type s;

it compiles without errors or warnings.  GCC version:

  $ g++ -v
  Reading specs from /usr/lib/gcc-lib/i486-slackware-linux/3.2.3/specs
  Configured with: ../gcc-3.2.3/configure --prefix=/usr --enable-shared 
    --enable-threads=posix --enable-__cxa_atexit --disable-checking
    --with-gnu-ld --verbose --target=i486-slackware-linux
    --host=i486-slackware-linux
  Thread model: posix
  gcc version 3.2.3

Also verified on 3.3.2.

Is this a bug?  I always thought typeof(...) was supposed to be
just as good as the type defined with typedef.

-- 
 Haakon

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-22 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-22 23:13 typeof(obj)::size_type doesn't work Haakon Riiser

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).