public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/36699]  New: not compile code, but must
@ 2008-07-02 16:44 yeolahim at gmail dot com
  2008-07-07 23:31 ` [Bug c++/36699] " bangerth at dealii dot org
  0 siblings, 1 reply; 2+ messages in thread
From: yeolahim at gmail dot com @ 2008-07-02 16:44 UTC (permalink / raw)
  To: gcc-bugs

try compile:

#include <iostream>

template <typename T, size_t Count>
inline
size_t countof ( const T (&) [Count] )
{
  return Count;
}

int main(int argc, char* argv[])
{
  struct { int x1; int x2;} x [100];
  std::cout << countof(x) << std::endl;

  int y [101];
  std::cout << countof(y) << std::endl;

  struct Z { int x1; int x2;} z [102];
  std::cout << countof(z) << std::endl;

  std::cin.get();
  return 0;
}


gcc info(gcc -v):
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)


-- 
           Summary: not compile code, but must
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yeolahim at gmail dot com
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


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


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

* [Bug c++/36699] not compile code, but must
  2008-07-02 16:44 [Bug c++/36699] New: not compile code, but must yeolahim at gmail dot com
@ 2008-07-07 23:31 ` bangerth at dealii dot org
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth at dealii dot org @ 2008-07-07 23:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bangerth at dealii dot org  2008-07-07 23:30 -------
Not a bug: type arguments to templates need to be *named* types with
external linkage. The declaration of 'x' uses an unnamed structure,
the declaration of 'z' a type of function-scope (and so internal) linkage.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2008-07-07 23:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-02 16:44 [Bug c++/36699] New: not compile code, but must yeolahim at gmail dot com
2008-07-07 23:31 ` [Bug c++/36699] " bangerth at dealii 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).