Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: tools/clang/rewrite_to_chrome_style/tests/template-expected.cc

Issue 2622003002: rewrite_to_chrome_style: Make is-const decisions more consistent (Closed)
Patch Set: consistant-consts-2 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/clang/rewrite_to_chrome_style/tests/template-expected.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc
index dc46c19a3aa345014db984d2128b1f13d9cf8c86..4f339ee16bcbc3ff21407204af95da2e4a08109a 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/template-expected.cc
@@ -76,6 +76,40 @@ void F() {
const int kIsAConstToo = number;
}
+namespace test_member_in_template {
+
+template <typename T>
+class HasAMember {
+ public:
+ HasAMember() {}
+ HasAMember(const T&) {}
+
+ void UsesMember() { const int not_const = i_; }
+ void AlsoUsesMember();
+
+ private:
+ int i_;
+};
+
+template <typename T>
+void HasAMember<T>::AlsoUsesMember() {
+ const int not_const = i_;
+}
+
+template <typename T>
+static void BasedOnSubType(const HasAMember<T>& t) {
+ const HasAMember<T> problematic_not_const(t);
+}
+
+void Run() {
+ HasAMember<int>().UsesMember();
+
+ BasedOnSubType<int>(HasAMember<int>());
+ enum E { A };
+ BasedOnSubType<E>(HasAMember<E>());
+}
+}
+
namespace test_template_arg_is_function {
void F(int x) {}

Powered by Google App Engine
This is Rietveld 408576698