diff options
| author | Larisse Voufo <lvoufo@google.com> | 2014-07-29 18:44:19 +0000 |
|---|---|---|
| committer | Larisse Voufo <lvoufo@google.com> | 2014-07-29 18:44:19 +0000 |
| commit | b6fab26109b0cdca3b83542ec88f6ceb7130ee66 (patch) | |
| tree | cdb9a1ed740e501f2327ac0cb885dc04d57cf0b3 /clang/test | |
| parent | b5adb212405905aab3cb037e8316ec04c72ec74d (diff) | |
| download | bcm5719-llvm-b6fab26109b0cdca3b83542ec88f6ceb7130ee66.tar.gz bcm5719-llvm-b6fab26109b0cdca3b83542ec88f6ceb7130ee66.zip | |
Fix PR10177 where non-type template arguments to alias templates are not marked as used in dependent contexts. The fix actually forces non-dependent names to be checked at template definition time as expected from the standard.
llvm-svn: 214192
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/PR10177.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/test/SemaCXX/PR10177.cpp b/clang/test/SemaCXX/PR10177.cpp index 8d745de0a6a..8093e18e332 100644 --- a/clang/test/SemaCXX/PR10177.cpp +++ b/clang/test/SemaCXX/PR10177.cpp @@ -9,22 +9,28 @@ struct U { static int a; }; -template<int N> struct S; // expected-note 2{{here}} +template<int N> struct S; // expected-note 6{{here}} template<int N> -int U<N>::a = S<N>::kError; // expected-error 2{{undefined}} +int U<N>::a = S<N>::kError; // expected-error 6{{undefined}} template<typename T> void f() { - // FIXME: The standard suggests that U<0>::a is odr-used by this expression, - // but it's not entirely clear that's the right behaviour. - (void)alias_ref<int, int&, U<0>::a>(); + (void)alias_ref<int, int&, U<0>::a>(); // expected-note {{here}} (void)func_ref<int, int&, U<1>::a>(); // expected-note {{here}} (void)class_ref<int, int&, U<2>::a>(); // expected-note {{here}} }; +template<int N> +void fi() { + (void)alias_ref<int, int&, U<N>::a>(); // expected-note {{here}} + (void)func_ref<int, int&, U<N+1>::a>(); // expected-note {{here}} + (void)class_ref<int, int&, U<N+2>::a>(); // expected-note {{here}} +}; + int main() { - f<int>(); // expected-note 2{{here}} + f<int>(); // NOTE: Non-dependent name uses are type-checked at template definition time. + fi<10>(); // expected-note 3{{here}} } namespace N { @@ -38,3 +44,4 @@ namespace N { } int j = f<int>(); } + |

