diff options
| author | Hans Wennborg <hans@hanshq.net> | 2013-11-21 03:17:44 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2013-11-21 03:17:44 +0000 |
| commit | 84fe12d1e954a344b24069367bd5282b6a08dcc7 (patch) | |
| tree | e99320b901340bed5833cf680ec1f7f35018c76d /clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp | |
| parent | 4a4b5dcb7d76eb852d620fff9924a29cb0f63afa (diff) | |
| download | bcm5719-llvm-84fe12d1e954a344b24069367bd5282b6a08dcc7.tar.gz bcm5719-llvm-84fe12d1e954a344b24069367bd5282b6a08dcc7.zip | |
Provide better diagnostic wording for initializers on static
data member definitions when the variable has an initializer
in its declaration.
For the following code:
struct S {
static const int x = 42;
};
const int S::x = 42;
This patch changes the diagnostic from:
a.cc:4:14: error: redefinition of 'x'
const int S::x = 42;
^
a.cc:2:20: note: previous definition is here
static const int x = 42;
^
to:
a.cc:4:18: error: static data member 'x' already has an initializer
const int S::x = 42;
^
a.cc:2:24: note: previous initialization is here
static const int x = 42;
^
Differential Revision: http://llvm-reviews.chandlerc.com/D2235
llvm-svn: 195306
Diffstat (limited to 'clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp index 94d0f16f06e..1e959364280 100644 --- a/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp +++ b/clang/test/SemaCXX/cxx1y-variable-templates_in_class.cpp @@ -39,11 +39,11 @@ namespace out_of_line { template<typename T> CONST T B1::right<T,int> = T(5); class B2 { - template<typename T, typename T0> static CONST T right = T(100); // expected-note {{previous definition is here}} - template<typename T> static CONST T right<T,int> = T(5); // expected-note {{previous definition is here}} + template<typename T, typename T0> static CONST T right = T(100); // expected-note {{previous initialization is here}} + template<typename T> static CONST T right<T,int> = T(5); // expected-note {{previous initialization is here}} }; - template<typename T, typename T0> CONST T B2::right = T(100); // expected-error {{redefinition of 'right'}} - template<typename T> CONST T B2::right<T,int> = T(5); // expected-error {{redefinition of 'right'}} + template<typename T, typename T0> CONST T B2::right = T(100); // expected-error {{static data member 'right' already has an initializer}} + template<typename T> CONST T B2::right<T,int> = T(5); // expected-error {{static data member 'right' already has an initializer}} class B3 { template<typename T, typename T0> static CONST T right = T(100); |

