From 69182ce4ed95c62d51e208c8620ff4e6599dee2e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 12 Jan 2015 21:47:01 +0100 Subject: [PATCH] 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. --- Tests/CompileFeatures/cxx_auto_type.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tests/CompileFeatures/cxx_auto_type.cpp b/Tests/CompileFeatures/cxx_auto_type.cpp index 7dbf04f67..1f36a7966 100644 --- a/Tests/CompileFeatures/cxx_auto_type.cpp +++ b/Tests/CompileFeatures/cxx_auto_type.cpp @@ -1,5 +1,12 @@ +double foo_ = 3.14; + +double& foo() +{ + return foo_; +} + void someFunc() { - auto x = 3.14; + auto& x = foo(); }