diff options
| author | Nico Rieck <nico.rieck@gmail.com> | 2014-01-21 23:54:36 +0000 |
|---|---|---|
| committer | Nico Rieck <nico.rieck@gmail.com> | 2014-01-21 23:54:36 +0000 |
| commit | f8e8b5f5c29678288f1a71bd2f14a3ba6843b112 (patch) | |
| tree | e119498c5bcdf004603129d5ab4e0e0a902731de /clang/test/SemaCXX/attr-weak.cpp | |
| parent | 601b22c37741559037cfb1b75d9331ed3481bc76 (diff) | |
| download | bcm5719-llvm-f8e8b5f5c29678288f1a71bd2f14a3ba6843b112.tar.gz bcm5719-llvm-f8e8b5f5c29678288f1a71bd2f14a3ba6843b112.zip | |
Delay attribute checking until auto types are deduced
Checking in ActOnVariableDeclarator computes and caches the linkage using
the non-deduced auto type which defaults to external linkage. Depending on
how the auto type is deduced linkage can change and conflict with the
cached linkage, hitting asserts.
llvm-svn: 199774
Diffstat (limited to 'clang/test/SemaCXX/attr-weak.cpp')
| -rw-r--r-- | clang/test/SemaCXX/attr-weak.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/attr-weak.cpp b/clang/test/SemaCXX/attr-weak.cpp index 2000e7fc683..8ba3a954282 100644 --- a/clang/test/SemaCXX/attr-weak.cpp +++ b/clang/test/SemaCXX/attr-weak.cpp @@ -1,4 +1,4 @@ -// 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}} @@ -31,8 +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}} |

