public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27061]  New: instantiation of template functions for locally defined classes
@ 2006-04-06 15:16 mmirzaza at cs dot uwaterloo dot ca
  2006-04-06 16:25 ` [Bug c++/27061] " pinskia at gcc dot gnu dot org
  2006-04-13  1:56 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: mmirzaza at cs dot uwaterloo dot ca @ 2006-04-06 15:16 UTC (permalink / raw)
  To: gcc-bugs

When the folliwng program is compiled: 

template <typename T> void f(T x) {}
int main()
{
        class A{} a;
        f(a);
}

g++ syas:

test.cc: In function 'int main()':
test.cc:5: error: no matching function for call to 'f(main()::A&)'

but if you move the class definition outside the main function, the error
disappears.


-- 
           Summary: instantiation of template functions for locally defined
                    classes
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mmirzaza at cs dot uwaterloo dot ca


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


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

* [Bug c++/27061] instantiation of template functions for locally defined classes
  2006-04-06 15:16 [Bug c++/27061] New: instantiation of template functions for locally defined classes mmirzaza at cs dot uwaterloo dot ca
@ 2006-04-06 16:25 ` pinskia at gcc dot gnu dot org
  2006-04-13  1:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-06 16:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-06 16:24 -------
The code is invalid as you cannot use a template with a local class as it has
local linkage.
I don't know if the error message could be improved or not.  


-- 


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


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

* [Bug c++/27061] instantiation of template functions for locally defined classes
  2006-04-06 15:16 [Bug c++/27061] New: instantiation of template functions for locally defined classes mmirzaza at cs dot uwaterloo dot ca
  2006-04-06 16:25 ` [Bug c++/27061] " pinskia at gcc dot gnu dot org
@ 2006-04-13  1:56 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-13  1:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-04-13 01:56 -------
The diagnostic issue is PR 15672.

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


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-04-13  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-06 15:16 [Bug c++/27061] New: instantiation of template functions for locally defined classes mmirzaza at cs dot uwaterloo dot ca
2006-04-06 16:25 ` [Bug c++/27061] " pinskia at gcc dot gnu dot org
2006-04-13  1:56 ` pinskia 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).