[LLVMbugs] [Bug 8446] New: unhelpful error message for missing typename

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 23 11:58:23 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8446

           Summary: unhelpful error message for missing typename
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: luc_j_bourhis at mac.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


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!!

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list