Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7873 Discussions

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

Jascha_Wetzel
Beginner
452 Views

ICL Version 13.0.1.119 Build 20121008
[cpp]
#include <vector>
int main()
{
    std::vector<int> v;
    for ( auto& x : v.size() )
        ++x;
}
[/cpp]
results in
[plain]
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() )
                      ^
[/plain]
Could be a friendlierr error message.

0 Kudos
1 Reply
Judith_W_Intel
Employee
452 Views
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)
0 Kudos
Reply