]> granicus.if.org Git - clang/commitdiff
Add another testcase missed from r284905.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Oct 2016 01:32:45 +0000 (01:32 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 22 Oct 2016 01:32:45 +0000 (01:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284906 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4.cpp [new file with mode: 0644]

diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p4.cpp
new file mode 100644 (file)
index 0000000..1a3732d
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++1z -verify %s
+
+void f() noexcept;
+void (&r)() = f;
+void (&s)() noexcept = r; // expected-error {{cannot bind}}
+
+void (&cond1)() noexcept = true ? r : f; // expected-error {{cannot bind}}
+void (&cond2)() noexcept = true ? f : r; // expected-error {{cannot bind}}
+// FIXME: Strictly, the rules in p4 don't allow this, because the operand types
+// are not of the same type other than cv-qualifiers, but we consider that to
+// be a defect, and instead allow reference-compatible types here.
+void (&cond3)() = true ? r : f;
+void (&cond4)() = true ? f : r;