public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35087]  New: g++ fails to compile local class which is passed to template function
@ 2008-02-05  9:24 deathbaba at gmail dot com
  2008-02-05 10:05 ` [Bug c++/35087] " pcarlini at suse dot de
  0 siblings, 1 reply; 2+ messages in thread
From: deathbaba at gmail dot com @ 2008-02-05  9:24 UTC (permalink / raw)
  To: gcc-bugs

The code example below compiles successfully under Microsoft Visual Studio 2005
SP1.

Minimal steps to reproduce:

-------------------------------------------------
template<typename T> void foo(T &) {}

int main()
{
  struct A
  {
    int m;
  };

  A a;
  foo(a);

  return 0;
}

-----------------------------------------

alexz@alexz-debian:~$ g++ test.cpp
test.cpp: In function 'int main()':
test.cpp:11: error: no matching function for call to 'foo(main()::A&)'

alexz@alexz-debian:~$ g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)


-- 
           Summary: g++ fails to compile local class which is passed to
                    template function
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: deathbaba at gmail dot com
  GCC host triplet: Linux version 2.6.18-4-k7 (Debian 2.6.18.dfsg.1-12)
                    (waldi@debia


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


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

* [Bug c++/35087] g++ fails to compile local class which is passed to template function
  2008-02-05  9:24 [Bug c++/35087] New: g++ fails to compile local class which is passed to template function deathbaba at gmail dot com
@ 2008-02-05 10:05 ` pcarlini at suse dot de
  0 siblings, 0 replies; 2+ messages in thread
From: pcarlini at suse dot de @ 2008-02-05 10:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pcarlini at suse dot de  2008-02-05 10:00 -------
This is illegal in C++03, per 14.3.1/2, and no strictly conforming compiler
accepts it.


-- 

pcarlini at suse dot de changed:

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


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


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

end of thread, other threads:[~2008-02-05 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05  9:24 [Bug c++/35087] New: g++ fails to compile local class which is passed to template function deathbaba at gmail dot com
2008-02-05 10:05 ` [Bug c++/35087] " pcarlini at suse dot de

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