This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34667] New: Ambiguous error message on partial member specialization
- From: "philippe at fornux dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jan 2008 00:42:23 -0000
- Subject: [Bug c++/34667] New: Ambiguous error message on partial member specialization
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code will not compile even if the error message doesn't make
sense, because it obviously knows which member to instantiate.
This may be a compiler bug issue, or and ambiguous error message.
#include <iostream>
using namespace std;
template <typename T>
class vector
{
vector();
public:
template <unsigned S>
vector(T (& array) [S])
{
cout << sizeof(array) / sizeof(T) << endl;
}
};
int main()
{
vector<int> a((int []) {0, 1, 2, 4, 5});
}
$ g++ temp.cpp
temp.cpp: In function `int main()':
temp.cpp:22: error: no matching function for call to
`vector<int>::vector(int[5])'
temp.cpp:9: note: candidates are: vector<int>::vector(const vector<int>&)
temp.cpp:15: note: vector<T>::vector(T (&)[S]) [with unsigned
int S = 5u, T = int]
temp.cpp:10: note: vector<T>::vector() [with T = int]
--
Summary: Ambiguous error message on partial member specialization
Product: gcc
Version: 3.4.6
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: philippe at fornux dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34667