[cfe-commits] r99937 - /cfe/trunk/test/CXX/stmt.stmt/stmt.select/p3.cpp
Douglas Gregor
dgregor at apple.com
Tue Mar 30 15:07:46 PDT 2010
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
More information about the cfe-commits
mailing list