summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-11-03 23:51:28 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-11-03 23:51:28 +0000
commit42350dfcc82c0f9a67feaacaa6581fdd54841416 (patch)
treef05dabdbd9189d96f1666b7a97c9697f8969b06c /clang/test
parent99c096472d789c7f60c81f99b28b3071565c9508 (diff)
downloadbcm5719-llvm-42350dfcc82c0f9a67feaacaa6581fdd54841416.tar.gz
bcm5719-llvm-42350dfcc82c0f9a67feaacaa6581fdd54841416.zip
Sema: Do not allow overloading between methods based on restrict
If the sole distinction between two declarations is that one has a __restrict qualifier then we should not consider it to be an overload. Instead, we will consider it as an incompatible redeclaration which is similar to how MSVC, ICC and GCC would handle it. This fixes PR17786. N.B. We must not mangle in __restrict into method qualifiers becase we don't allow overloading between such declarations anymore. To do otherwise would be a violation of the Itanium ABI. llvm-svn: 193964
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGenCXX/mangle.cpp9
-rw-r--r--clang/test/SemaCXX/overload-decl.cpp5
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp
index 4e6dbf5397a..d836f36c181 100644
--- a/clang/test/CodeGenCXX/mangle.cpp
+++ b/clang/test/CodeGenCXX/mangle.cpp
@@ -942,3 +942,12 @@ namespace test43 {
void g(zed<&foo::bar>*)
{}
}
+
+namespace test44 {
+ struct foo { void bar() __restrict { }; } obj;
+
+ void f() {
+ obj.bar();
+ }
+ // CHECK-LABEL: define linkonce_odr void @_ZN6test443foo3barEv(%"struct.test44::foo"* %this)
+}
diff --git a/clang/test/SemaCXX/overload-decl.cpp b/clang/test/SemaCXX/overload-decl.cpp
index 0153620d45b..fdb14cb173e 100644
--- a/clang/test/SemaCXX/overload-decl.cpp
+++ b/clang/test/SemaCXX/overload-decl.cpp
@@ -29,6 +29,11 @@ class X {
static void g(float); // expected-note {{previous declaration is here}}
static void g(int); // expected-error {{static and non-static member functions with the same parameter types cannot be overloaded}}
static void g(float); // expected-error {{class member cannot be redeclared}}
+
+ void h(); // expected-note {{previous declaration is here}} \
+ expected-note {{previous declaration is here}}
+ void h() __restrict; // expected-error {{class member cannot be redeclared}} \
+ expected-error {{conflicting types for 'h'}}
};
int main() {} // expected-note {{previous definition is here}}
OpenPOWER on IntegriCloud