ICE instead of error message on range-based for-loop misuse

ICE instead of error message on range-based for-loop misuse

Jascha Wetzel的头像

ICL Version 13.0.1.119 Build 20121008

#include <vector>
int main()
{
    std::vector<int> v;
    for ( auto& x : v.size() )
        ++x;
}

results in
missing_error_message.cpp
missing_error_message.cpp(5): internal error: assertion failed at: "shared/cfe/edgcpfe/overload.c", line 8257
      for ( auto& x : v.size() )
                      ^

Could be a friendlierr error message.

2 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Judith Ward (Intel)的头像

Thank you for reporting this. This is being tracked in our bug database as DPD200239305. It is fixed in our under development compiler so you should see the fix in our next major release. This will be the error message:

!% icl -Qstd=c++11 -c bug.cpp
Intel(R) C++ Compiler XE for applications running on IA-32, Version Mainline Bet
a Build x
Built Nov 21 2012 19:44:17 by jward4 on JWARD4-DESK in D:/workspaces/45cfe/dev
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

bug.cpp
bug.cpp(7): error: this range-based "for" statement requires a suitable "begin"
function and none was found
for ( auto& x : v.size() )
^

bug.cpp(7): error: this range-based "for" statement requires a suitable "end" fu
nction and none was found
for ( auto& x : v.size() )
^

compilation aborted for bug.cpp (code 2)

登陆并发表评论。