Author: dgregor
Date: Tue Mar 30 17:07:46 2010
New Revision: 99937

URL: http://llvm.org/viewvc/llvm-project?rev=99937&view=rev
Log:
Add a test for C++ [stmt.select]p3, which specifies that redeclaring a
name in the outermost block of a if/else that declares the same name
is ill-formed. Turns out that Clang and MSVC were right about PR6739;
GCC is too lax.

Added:
    cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp   (with props)

Added: cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp?rev=99937&view=auto
==============================================================================
--- cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp (added)
+++ cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp Tue Mar 30 17:07:46 2010
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int f();
+
+void g() {
+  if (int x = f()) { // expected-note 2{{previous definition}}
+    int x; // expected-error{{redefinition of 'x'}}
+  } else {
+    int x; // expected-error{{redefinition of 'x'}}
+  }
+}

Propchange: cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp
------------------------------------------------------------------------------
    svn:mime-type = text/plain


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to