This may be a silly question, but why does the following code give me a compile error (only on Linux BTW, not Windows): template<typename TreeIterT> void ClassName::compile_something(const TreeIterT& iter, compile_context &ctx) { const TreeIterT::value_type& ident = get_first_leaf(*iter); } In member function `void ClassName::compile_something(const TreeIterT&, CompileContext&)': 128: error: syntax error before `&' token Also: template<typename TreeNodeT> void ClassName::compile_something_else(const TreeNodeT &tree, compile_context &ctx) { TreeNodeT::const_iterator iter = tree.begin(); } In member function `void ClassName::compile_something_else(const 138: error: syntax error before `=' token Any idea what is causing this?
fmonkey@fmonkey.net wrote:
This may be a silly question, but why does the following code give me a compile error (only on Linux BTW, not Windows):
template<typename TreeIterT> void ClassName::compile_something(const TreeIterT& iter, compile_context &ctx) { const TreeIterT::value_type& ident = get_first_leaf(*iter); }
typename const TreeIterT::value_type& ident = get_first_leaf(*iter);
In member function `void ClassName::compile_something(const TreeIterT&, CompileContext&)': 128: error: syntax error before `&' token
Also:
template<typename TreeNodeT> void ClassName::compile_something_else(const TreeNodeT &tree, compile_context &ctx) { TreeNodeT::const_iterator iter = tree.begin(); }
typename TreeNodeT::const_iterator iter = tree.begin();
In member function `void ClassName::compile_something_else(const 138: error: syntax error before `=' token
participants (2)
-
Edward Diener
-
fmonkey@fmonkey.net