aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-30 22:07:46 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-30 22:07:46 +0000
commit3be9678105f10c49c4ebc5ce353f770c3a50f9c7 (patch)
tree4a8ef2fa1cabe23d4a6311cfe88e35b506e0863a
parent6bb8017bb9e828d118e15e59d71c66bba323c364 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99937 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CXX/stmt.stmt/stmt.select/p3.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CXX/stmt.stmt/stmt.select/p3.cpp b/test/CXX/stmt.stmt/stmt.select/p3.cpp
new file mode 100644
index 0000000000..e674f9708c
--- /dev/null
+++ b/test/CXX/stmt.stmt/stmt.select/p3.cpp
@@ -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'}}
+ }
+}