This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16610] New: constructor template binding different than plain function for same types
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2004 21:03:04 -0000
- Subject: [Bug c++/16610] New: constructor template binding different than plain function for same types
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
in:
#include <iostream>
template<typename T>
void Foo(T*const& t) { std::cout << "reference\n"; }
template<typename T, size_t s>
void Foo(T(&t)[s]) { std::cout << "array\n"; }
template<typename T>
struct Frob {
Frob(T*const& t) { std::cout << "reference\n"; }
template<size_t s>
Frob(T(&t)[s]) { std::cout << "array\n"; }
};
int main() {
int* ri;
int ra[10];
Foo(ri);
Foo(ra);
Foo(new int[2]);
Frob<int> f1(ri);
Frob<int> f2(ra);
Frob<int> f3(new int[2]);
Frob<int> f4 = ri;
Frob<int> f5 = ra;
Frob<int> f6 = new int[2];
}
you get:
~/ootbc/members/members/sweetie/test/src$ a.out
reference
array
reference
reference
reference
reference
reference
reference
reference
Ivan
--
Summary: constructor template binding different than plain
function for same types
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=16610