public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15674] New: template argument binding differs between member and static fumctions
@ 2004-05-27 18:18 igodard at pacbell dot net
  2004-05-27 18:58 ` [Bug c++/15674] " giovannibajo at libero dot it
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: igodard at pacbell dot net @ 2004-05-27 18:18 UTC (permalink / raw)
  To: gcc-bugs

#include <iostream>

int a[5];
int* p;

template<typename T>
class Foo {
public:
void S(T*) { std::cout << "found ref" << std::endl; }

template<size_t n>
void S(T(&a)[n]) { std::cout << "found array" << std::endl; }
};

template<typename T>
void S(T*) { std::cout << "found ref" << std::endl; }

template<typename T, size_t n>
void S(T(&a)[n]) { std::cout << "found array" << std::endl; }

int main() {
    Foo<int> s;
    s.S(a);
    s.S(p);
    S(a);
    S(p);
    return 0;
    }

When run, this produces:
~/ootbc/common/test/src$ a.out
found ref
found ref
found array
found ref

That is, the two calls to the member S both bind to the T* template, but for the global functions with identical signature one binds to each overload.

Ivan

-- 
           Summary: template argument binding differs between member and
                    static fumctions
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-06-06 12:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-27 18:18 [Bug c++/15674] New: template argument binding differs between member and static fumctions igodard at pacbell dot net
2004-05-27 18:58 ` [Bug c++/15674] " giovannibajo at libero dot it
2004-05-27 19:14 ` nathan at gcc dot gnu dot org
2004-05-27 19:49 ` igodard at pacbell dot net
2004-05-27 19:51 ` [Bug c++/15674] [3.3/3.4/3.5 Regression] [DR214] " giovannibajo at libero dot it
2004-05-28  1:42 ` nathan at gcc dot gnu dot org
2004-05-28 14:51 ` giovannibajo at libero dot it
2004-05-28 22:33 ` nathan at gcc dot gnu dot org
2004-11-26 23:22 ` [Bug c++/15674] [3.3/3.4/4.0 " neroden at gcc dot gnu dot org
2004-12-01 18:20 ` [Bug c++/15674] " mmitchel at gcc dot gnu dot org
2004-12-19 13:36 ` pinskia at gcc dot gnu dot org
2005-04-07  7:09 ` [Bug c++/15674] [4.0 only] " pinskia at gcc dot gnu dot org
2005-04-07  7:28 ` igodard at pacbell dot net
2005-05-10 13:30 ` nathan at gcc dot gnu dot org
2005-05-26 23:29 ` mmitchel at gcc dot gnu dot org
2005-06-06 11:45 ` [Bug c++/15674] " nathan at gcc dot gnu dot org
2005-06-06 12:35 ` nathan 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).