Re: Erroneous for-loop variable used with /Zc:forScope
This is the smaller full example I could built.
#pragma conform(forScope, show)
namespace boost { namespace spirit {
namespace impl {
template <typename T>
inline void mp_swap(T& t1, T& t2);
}
#pragma conform(forScope, show)
namespace multi_pass_policies
{
class buf_id_check
{
protected:
void swap(buf_id_check& x)
{
impl::mp_swap(shared_buf_id, x.shared_buf_id);
impl::mp_swap(buf_id, x.buf_id);
}
unsigned long* shared_buf_id;
unsigned long buf_id;
};
#pragma conform(forScope, show)
} // namespace multi_pass_policies
namespace impl {
template <typename T>
inline void mp_swap(T& t1, T& t2)
{
}
}
#pragma conform(forScope, show)
}} // namespace boost::spirit
#pragma conform(forScope, show)
struct A
{
bool operator!=(int);
A&operator++();
};
int main(int argc, char **argv)
{
#pragma conform(forScope, show)
for(int i = 0; i != 10; i++)
{
for(A i; i != 0; ++i)
{
}
i = 5;
}
}
---
Error messages:
main.cpp(2) : warning C4811: value of pragma conform(forScope, show)
== true
main.cpp(11) : warning C4811: value of pragma conform(forScope, show)
== true
main.cpp(29) : warning C4811: value of pragma conform(forScope, show)
== true
main.cpp(41) : warning C4811: value of pragma conform(forScope, show)
== true
main.cpp(45) : warning C4811: value of pragma conform(forScope, show)
== true
main.cpp(55) : warning C4811: value of pragma conform(forScope, show)
== true
msvc.link bin\msvc-8.0express\debug\threading-multi\spirit-test.exe
main.obj : error LNK2019: unresolved external symbol "public: bool
__thiscall A::operator!=(int)" (??9A@@QAE_NH@Z) referenced in function
_main
main.obj : error LNK2019: unresolved external symbol "public: struct A
& __thiscall A::operator++(void)" (??EA@@QAEAAU0@XZ) referenced in
function _main
bin\msvc-8.0express\debug\threading-multi\spirit-test.exe : fatal
error LNK1120: 2 unresolved externals
cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]