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

Unified Diff: tools/clang/rewrite_to_chrome_style/tests/template-original.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-original.cc
diff --git a/tools/clang/rewrite_to_chrome_style/tests/template-original.cc b/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
index 754e755de35ed7912433c7b03a426f36e0f85082..679008290855c179aaf6b4f124228e471c789062 100644
--- a/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
+++ b/tools/clang/rewrite_to_chrome_style/tests/template-original.cc
@@ -75,6 +75,40 @@ void F() {
const int isAConstToo = number;
}
+namespace test_member_in_template {
+
+template <typename T>
+class HasAMember {
+ public:
+ HasAMember() {}
+ HasAMember(const T&) {}
+
+ void usesMember() { const int notConst = m_i; }
+ void alsoUsesMember();
+
+ private:
+ int m_i;
+};
+
+template <typename T>
+void HasAMember<T>::alsoUsesMember() {
+ const int notConst = m_i;
+}
+
+template <typename T>
+static void basedOnSubType(const HasAMember<T>& t) {
+ const HasAMember<T> problematicNotConst(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