Why a formalparameter object can not be treated as object reference

Hi to all:
I have a test case which work well on VS2012,but i got an error when i compile it with clang++.
the test case is:
#include

class AA {
public:
AA(int i):ii(i){}
~AA(){}
public:
int ii;
};

int foo( AA& a) {
return a.ii;
}

int main() {
AA aa(1);
int rec1 = foo(aa);
int rec2 = foo(AA(1));
std::cout << rec1 << ‘\n’ << rec2 << ‘\n’;
return rec1 == rec2? 0 : 1;
}

the error is:
reference_test.cpp:18:14: error: no matching function for call to ‘foo’
int rec2 = foo(AA(1));

Is it a bug of clang or not?

It's an MSVC bug.

Thanks for your help,but why my test case can compile and run well on VS2012, they do not fix this bug still?
在 2012-10-31 10:54:22,"Richard Smith" <richard@metafoo.co.uk> 写道:

They will never fix this bug. There is far too much code relying on it.

C++ programs generally have very poor portability between implementations,
but moving from MSVC in particular is well-known to be painful. This is
unlikely to be the only problem you're going to run into.

John.

Thanks, in fact i had meet a problem caused by MSVC do allow spec,i did not realized another MSVC problem came,out of my thought.
在 2012-10-31 13:02:57,"John McCall" <rjmccall@apple.com> 写道: