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++/44906] g++ is giving error: parse error in template argument list while using a c++ code.


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

--- Comment #8 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2011-09-23 13:59:07 UTC ---
(In reply to comment #6)
> Honestly, nothing similar will happen any time soon, it means changing
> completely the semantics of templates. Maybe we can produce a better
> diagnostics, let's add Manuel in CC to hear his opinion...

The code is invalid but the diagnostic could be much better (I only have GCC
4.5.2, so perhaps it is better in trunk).

Smaller testcase:

template<typename T>
class MISC{
public:
    T vec1;
    template<T* vc> void addVecVals(){};
    void add(void) { addVecVals<&vec1>();  };
};

void foo(void) {
    MISC<int> m;
    m.add();
}

Clang++ gives a somewhat better message:

/tmp/webcompile/_14512_0.cc:6:22: error: no matching member function for call
to 'addVecVals'
    void add(void) { addVecVals<&vec1>();  };
                     ^~~~~~~~~~~~~~~~~
/tmp/webcompile/_14512_0.cc:11:7: note: in instantiation of member function
'MISC<int>::add' requested here
    m.add();
      ^
/tmp/webcompile/_14512_0.cc:5:26: note: candidate template ignored: invalid
explicitly-specified argument for template parameter 'vc'
    template<T* vc> void addVecVals(){};
                         ^
1 error generated.


I would argue for reopening it...


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