This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/34667] New: Ambiguous error message on partial member specialization


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]