You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2005/11/18 01:20:13 UTC

svn commit: r345383 - in /incubator/stdcxx/trunk/etc/config/src: FOR_LOCAL_SCOPE.cpp NO_FOR_LOCAL_SCOPE.cpp

Author: sebor
Date: Thu Nov 17 16:20:10 2005
New Revision: 345383

URL: http://svn.apache.org/viewcvs?rev=345383&view=rev
Log:
2005-11-17  Martin Sebor  <se...@roguewave.com>

	* FOR_LOCAL_SCOPE.cpp: Deleted an unreliable test (some compilers,
	such as gcc 2 or Intel C++ 8 on Windows) only issue a warning but
	do not actually reject the test.
	* NO_FOR_LOCAL_SCOPE.cpp: Implemented the same functionality as
	above but as a negative test, i.e., one which is considered passing
	on failure to compile.

Added:
    incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp   (with props)
Removed:
    incubator/stdcxx/trunk/etc/config/src/FOR_LOCAL_SCOPE.cpp

Added: incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp?rev=345383&view=auto
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp (added)
+++ incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp Thu Nov 17 16:20:10 2005
@@ -0,0 +1,18 @@
+// checking for scope of for-init-statements
+
+int foo (int n)
+{
+    int result = 0;
+
+    // 6.5.3, p3, the scope of `i' extends to the end of
+    // the for-statement (and not beyond)
+    for (int i = 0; i != n; ++i)
+        result += i;
+
+    // check to see if i is still in scope here
+    // if so, the test will compile succesfully
+    // indicating a failure
+    result *= i;
+
+    return result;
+}

Propchange: incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stdcxx/trunk/etc/config/src/NO_FOR_LOCAL_SCOPE.cpp
------------------------------------------------------------------------------
    svn:keywords = Id