typeof(obj)::size_type doesn't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux