VS2010 C++编译问题

csharpplus1 2009-11-20 10:43:25

template<bool val> class static_assert ;
template<> class static_assert<true> {};

好像就是上边2句的问题,请问这是什么错误啊


Error 1 error C2332: 'class' : missing tag name c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 pfc
Error 2 error C3306: 'pfc::<unnamed-tag>': unnamed class template is not allowed c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 pfc
Error 3 error C2143: syntax error : missing ';' before 'static_assert' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 pfc
Error 4 error C2059: syntax error : ';' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 pfc
Error 5 error C2332: 'class' : missing tag name c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 6 error C2143: syntax error : missing ';' before 'static_assert' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 7 error C2913: explicit specialization; 'pfc::<unnamed-tag>' is not a specialization of a class template c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 8 error C2059: syntax error : '<' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 9 error C2143: syntax error : missing ';' before '{' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 10 error C2447: '{' : missing function header (old-style formal list?) c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 pfc
Error 11 error C2332: 'class' : missing tag name c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 foobar2000_SDK
Error 12 error C3306: 'pfc::<unnamed-tag>': unnamed class template is not allowed c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 foobar2000_SDK
Error 13 error C2143: syntax error : missing ';' before 'static_assert' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 foobar2000_SDK
Error 14 error C2059: syntax error : ';' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 89 1 foobar2000_SDK
Error 15 error C2332: 'class' : missing tag name c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
Error 16 error C2143: syntax error : missing ';' before 'static_assert' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
Error 17 error C2913: explicit specialization; 'pfc::<unnamed-tag>' is not a specialization of a class template c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
Error 18 error C2059: syntax error : '<' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
Error 19 error C2143: syntax error : missing ';' before '{' c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
Error 20 error C2447: '{' : missing function header (old-style formal list?) c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 1 foobar2000_SDK
21 IntelliSense: expected either a definition or a tag name c:\users\zhenguo\desktop\sdk-2008-11-29\pfc\primitives.h 90 19 pfc
...全文
505 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
csharpplus1 2009-11-21
  • 打赏
  • 举报
回复
楼上能说的详细一点吗 ,不太懂C++
光宇广贞 2009-11-21
  • 打赏
  • 举报
回复
其实是想说,用 VC 2010 就有必要了解一下 C++0x……

[Quote=引用 5 楼 akirya 的回复:]
引用 4 楼 csharpplus1 的回复:
楼上能说的详细一点吗 ,不太懂C++

强悍啊,不太懂就能写这样的代码,佩服.
[/Quote]
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 csharpplus1 的回复:]
楼上能说的详细一点吗 ,不太懂C++
[/Quote]
强悍啊,不太懂就能写这样的代码,佩服.
  • 打赏
  • 举报
回复
static_assert已经升级到关键字了 ...
jackyjkchen 2009-11-20
  • 打赏
  • 举报
回复
template <>这种东西也少出现
mabo321 2009-11-20
  • 打赏
  • 举报
回复
猜测:
template <bool val> class static_assert {};

是否先得 定义?然后才能特化?

33,317

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧