[cfe-dev] unhelpful error message for missing typename
Eli Friedman
eli.friedman at gmail.com
Sat Oct 23 11:47:15 PDT 2010
On Sat, Oct 23, 2010 at 10:31 AM, Luc Bourhis <luc_j_bourhis at mac.com> wrote:
> Consider the following code (a reduction of some actual code of mine):
>
> ------------------------------------------------------------------------------------------------------
> struct site_symmetry_ops { };
>
> template <class wt>
> struct class_
> {
> template <class A1>
> void def(A1 const &a1) {}
> };
>
> template <class A1, class A2>
> struct init
> {
> init() { }
> };
>
> struct special_position_site_parameter {
> typedef char scatterer_type;
> };
>
> template <class wt>
> struct valued_asu_parameter_heir_wrapper
> {
> static class_<wt> wrap(char const *name) {
> return class_<wt>();
> }
> };
>
> template <class wt>
> struct special_position_wrapper
> {
> static void wrap(char const *name) {
> valued_asu_parameter_heir_wrapper<wt>::wrap(name)
> .def(init<site_symmetry_ops const &, wt::scatterer_type *>())
> ;
> }
> };
>
> void wrap_special_position() {
> special_position_wrapper<special_position_site_parameter>
> ::wrap("special_position_site_parameter");
> }
> ------------------------------------------------------------------------------------------------------
>
> clang++ (trunk 116866) generates the following error message:
>
> test.cpp:29:64: error: expected expression
> .def(init<site_symmetry_ops const &, wt::scatterer_type *>())
> ^
> 1 error generated.
>
> The problem is of course that a 'typename' is missing in front of 'wt::scatterer_type'. The error message does not suggest that, not even implicitly. This is the only case I know of where g++ error message is more informative than clang++ actually!!
Please file in Bugzilla, so we don't lose track of this issue.
-Eli
More information about the cfe-dev
mailing list