英特尔编译器不会编译另一个类中的私有前向类声明
我在使用英特尔编译器 11.1.xxx 时遇到一些问题 使用 MS CL 编译器进行编译时不会出现这些问题。 我不明白代码有什么问题(外部升压库头) 我最终遇到了多个错误:
<块引用>..\boost/log/attributes/attribute_set.hpp(148): 错误:声明不兼容 带有常量“bool fConstV”(声明 在第 147 行) 模板<布尔 fConstV >朋友类iter; ^ 期间检测到: 类“boost::log_mt::basic_attribute_set”的实例化 [with CharT=char]”位于第 252 行 “..\boost/log/sources/basic_logger.hpp” 类“boost::log_mt::sources::basic_logger [with 字符T=字符, FinalT=boost::log_mt::sources::logger, ThreadingModelT=boost::log_mt::sources::single_thread_model]" 在第 738 行 “..\boost/log/sources/basic_logger.hpp” 类“boost::log_mt::sources::basic_composite_logger [with CharT=char, FinalT=boost::log_mt::sources::logger, 特征T=boost::mpl::ve ctor0]”位于第 787 行 “..\boost/log/sources/basic_logger.hpp”
..\boost/log/attributes/named_scope.hpp(146): 错误:声明不兼容 带有常量“bool fConstV”(声明 在第 145 行) 模板<布尔 fConstV >朋友类iter; ^ 期间检测到: 类“boost::log_mt::attributes::basic_named_scope_list”的实例化 [with CharT=char]”位于第 364 行 类“boost::log_mt::attributes::basic_named_scope”的实例化 [with CharT=char]”位于第 94 行 “..\boost/log/formatters/named_scope.hpp” 类“boost::log_mt::formatters::fmt_named_scope”的实例化 [with CharT=char]”位于第 270 行 “..\boost/log/formatters/named_scope.hpp”
attributeset.hpp
template< typename CharT >
class basic_attribute_set
{
/* ... */
template< bool fConstV > class iter;
template< bool fConstV > friend class iter;
template< bool fConstV >
class iter
{
friend class iter< !fConstV >;
friend class basic_attribute_set< CharT >;
/* ... */
/* ... */
}
}
basiclogger.hpp
class logger : public basic_composite_logger< char, logger, single_thread_model, mpl::vector0< > >
{
BOOST_LOG_FORWARD_LOGGER_CONSTRUCTORS(logger)
};
欢迎任何提示。
I'm having some problems with Intel compiler 11.1.xxx
Those problems don't appear during compilation with MS CL compiler.
And I don't udnerstand what's wrong with the code (external boost library header)
I end up with multiple errors:
..\boost/log/attributes/attribute_set.hpp(148):
error: declaration is incompatible
with constant "bool fConstV" (declared
at line 147)
template< bool fConstV > friend class iter;
^
detected during:
instantiation of class "boost::log_mt::basic_attribute_set
[with CharT=char]" at line 252 of
"..\boost/log/sources/basic_logger.hpp"
instantiation of class "boost::log_mt::sources::basic_logger [with
CharT=char,
FinalT=boost::log_mt::sources::logger,
ThreadingModelT=boost::log_mt::sources::single_thread_model]"
at line 738 of
"..\boost/log/sources/basic_logger.hpp"
instantiation of class "boost::log_mt::sources::basic_composite_logger [with CharT=char,
FinalT=boost::log_mt::sources::logger,
FeaturesT=boost::mpl::ve
ctor0]" at line 787 of
"..\boost/log/sources/basic_logger.hpp"..\boost/log/attributes/named_scope.hpp(146):
error: declaration is incompatible
with constant "bool fConstV" (declared
at line 145)
template< bool fConstV > friend class iter;
^
detected during:
instantiation of class "boost::log_mt::attributes::basic_named_scope_list
[with CharT=char]" at line 364
instantiation of class "boost::log_mt::attributes::basic_named_scope
[with CharT=char]" at line 94 of
"..\boost/log/formatters/named_scope.hpp"
instantiation of class "boost::log_mt::formatters::fmt_named_scope
[with CharT=char]" at line 270 of
"..\boost/log/formatters/named_scope.hpp"
attributeset.hpp
template< typename CharT >
class basic_attribute_set
{
/* ... */
template< bool fConstV > class iter;
template< bool fConstV > friend class iter;
template< bool fConstV >
class iter
{
friend class iter< !fConstV >;
friend class basic_attribute_set< CharT >;
/* ... */
/* ... */
}
}
basiclogger.hpp
class logger : public basic_composite_logger< char, logger, single_thread_model, mpl::vector0< > >
{
BOOST_LOG_FORWARD_LOGGER_CONSTRUCTORS(logger)
};
Any hints welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在第 148 行你想要
template;友元类 iter;
?不过,由于iter
被声明为嵌套类,我认为您不需要朋友声明;maybe at line 148 you want
template <bool fConstV> friend class iter<fConstV>;
? Though, asiter
is declared as a nested class, I don't think you need the friend declaration;