aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/attr-weak.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/attr-weak.cpp')
-rw-r--r--test/SemaCXX/attr-weak.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/SemaCXX/attr-weak.cpp b/test/SemaCXX/attr-weak.cpp
index 8939a28d75e1..8ba3a954282d 100644
--- a/test/SemaCXX/attr-weak.cpp
+++ b/test/SemaCXX/attr-weak.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify -std=c++11 %s
static int test0 __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
static void test1() __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}
-namespace test2 __attribute__((weak)) { // expected-warning {{'weak' attribute only applies to variables and functions}}
+namespace test2 __attribute__((weak)) { // expected-warning {{'weak' attribute only applies to variables, functions and classes}}
}
namespace {
@@ -31,6 +31,10 @@ template <class T> struct Test7 {
};
template <class T>
int Test7<T>::var;
-namespace { class Internal; }
+namespace { class Internal {}; }
template struct Test7<Internal>;
template struct Test7<int>;
+
+class __attribute__((weak)) Test8 {}; // OK
+
+__attribute__((weak)) auto Test9 = Internal(); // expected-error {{weak declaration cannot have internal linkage}}