c++ - What does "error: cannot use type 'void' as a range" actually mean? -


when compile in clang 3.2

for(auto x : {1, 1.2}){} 

i error this:

error: cannot use type 'void' range

what mean?

you mixed types in initializer list. in case can pretty clear, don't forget

std::string foo; for(auto x : {foo, "bar"}){} 

are 2 separate types. there of course plenty of other cases may expect work, types have match exactly.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -