Features: Ensure that the cxx_auto_type test is correct.

SolarisStudio considers 'auto' to be a storage class specifier in
C++98 mode (as appropriate), and considers variables without a specified
type to be of type int.  So, it treats

 auto x = 3.14;

as

 auto int x = 3.14;

which in C++98 mode is equivalent to

 int x = 3.14;

and it does not fail to compile as expected.

Change the test to use a reference so that the type must be known.
This commit is contained in:
Stephen Kelly 2015-01-12 21:47:01 +01:00
parent 54156d723a
commit 69182ce4ed
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,12 @@
double foo_ = 3.14;
double& foo()
{
return foo_;
}
void someFunc()
{
auto x = 3.14;
auto& x = foo();
}