OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include <type_traits> |
| 6 |
5 namespace not_blink { | 7 namespace not_blink { |
6 | 8 |
7 void function(int x) {} | 9 void function(int x) {} |
8 | 10 |
9 class Class { | 11 class Class { |
10 public: | 12 public: |
11 void method() {} | 13 void method() {} |
12 template <typename T> | 14 template <typename T> |
13 void methodTemplate(T) {} | 15 void methodTemplate(T) {} |
14 template <typename T> | 16 template <typename T> |
15 static void staticMethodTemplate(T) {} | 17 static void staticMethodTemplate(T) {} |
16 }; | 18 }; |
17 | 19 |
18 template <typename T> | 20 template <typename T> |
19 void functionTemplate(T x) {} | 21 void functionTemplate(T x) {} |
20 | 22 |
| 23 template <typename T = Class> |
| 24 void functionTemplate2() { |
| 25 T::staticMethodTemplate(123); |
| 26 } |
| 27 |
| 28 template <typename T = Class> |
| 29 class TemplatedClass { |
| 30 public: |
| 31 void anotherMethod() { T::staticMethodTemplate(123); } |
| 32 }; |
| 33 |
21 } // not_blink | 34 } // not_blink |
22 | 35 |
23 namespace blink { | 36 namespace blink { |
24 | 37 |
25 template <typename T, int number> | 38 template <typename T, int number> |
26 void F() { | 39 void F() { |
27 // We don't assert on this, and we don't end up considering it a const for | 40 // We don't assert on this, and we don't end up considering it a const for |
28 // now. | 41 // now. |
29 const int maybe_a_const = sizeof(T); | 42 const int maybe_a_const = sizeof(T); |
30 const int is_a_const = number; | 43 const int is_a_const = number; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 186 |
174 template <typename T> | 187 template <typename T> |
175 void Class<T>::f(int dataSize){}; | 188 void Class<T>::f(int dataSize){}; |
176 | 189 |
177 void foo() { | 190 void foo() { |
178 Class<char>().f(123); | 191 Class<char>().f(123); |
179 }; | 192 }; |
180 | 193 |
181 } // namespace test_unnamed_arg | 194 } // namespace test_unnamed_arg |
182 | 195 |
| 196 namespace test_new_array_bug { |
| 197 |
| 198 class PartitionAllocator { |
| 199 public: |
| 200 static void method() {} |
| 201 }; |
| 202 |
| 203 template <typename Allocator = PartitionAllocator> |
| 204 class Vector { |
| 205 public: |
| 206 // https://crbug.com/582315: |Allocator::method| is a |
| 207 // CXXDependentScopeMemberExpr. |
| 208 void anotherMethod() { |
| 209 if (std::is_class<Allocator>::value) // Shouldn't rename |value| |
| 210 Allocator::method(); // Should rename |method| -> |Method|. |
| 211 } |
| 212 }; |
| 213 |
| 214 template <typename Allocator = PartitionAllocator> |
| 215 void test() { |
| 216 // https://crbug.com/582315: |Allocator::method| is a |
| 217 // DependentScopeDeclRefExpr. |
| 218 if (std::is_class<Allocator>::value) // Shouldn't rename |value|. |
| 219 Allocator::method(); // Should rename |method|. |
| 220 } |
| 221 |
| 222 } // namespace test_new_array_bug |
| 223 |
183 } // namespace blink | 224 } // namespace blink |
OLD | NEW |