>From the GCC mailinglist:

   G++ has had a long-standing bug with unqualified name resolution in
   templates: if we didn't find any declaration when looking up a name in
   the template definition, we would do an additional unqualified lookup
   at the point of instantiation.  This led to incorrectly finding
   namespace-scope functions declared later (29131) and member functions
   of dependent bases (24163).

The supplied patch fixes the only place in the code that didn't
compile due to this fixed bug.

-- 
        Lgb
From 7c14679a8c48873219cd5e421c765b1d378349a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= <lar...@gullik.org>
Date: Sat, 21 May 2011 01:09:09 +0200
Subject: [PATCH] Fixup for bug removal in GCC 4.7

A long standing bug has been fixed in GCC 4.7, the bug was a non-
sactioned extra lookup. This caused some code to work that really
shouldn't.

The fixes are: add this->, Class::, or move functions about
as required to fullfill the rules.

In this case some template instantiations
where move to after what they reference.
---
 src/insets/InsetTabular.cpp |  111 +++++++++++++++++++++----------------------
 1 files changed, 55 insertions(+), 56 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 4a267e9..7a165e2 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -188,62 +188,6 @@ TabularFeature tabularFeature[] =
 };
 
 
-template <class T>
-string const write_attribute(string const & name, T const & t)
-{
-	string const s = tostr(t);
-	return s.empty() ? s : " " + name + "=\"" + s + "\"";
-}
-
-template <>
-string const write_attribute(string const & name, string const & t)
-{
-	return t.empty() ? t : " " + name + "=\"" + t + "\"";
-}
-
-
-template <>
-string const write_attribute(string const & name, docstring const & t)
-{
-	return t.empty() ? string() : " " + name + "=\"" + to_utf8(t) + "\"";
-}
-
-
-template <>
-string const write_attribute(string const & name, bool const & b)
-{
-	// we write only true attribute values so we remove a bit of the
-	// file format bloat for tabulars.
-	return b ? write_attribute(name, convert<string>(b)) : string();
-}
-
-
-template <>
-string const write_attribute(string const & name, int const & i)
-{
-	// we write only true attribute values so we remove a bit of the
-	// file format bloat for tabulars.
-	return i ? write_attribute(name, convert<string>(i)) : string();
-}
-
-
-template <>
-string const write_attribute(string const & name, Tabular::idx_type const & i)
-{
-	// we write only true attribute values so we remove a bit of the
-	// file format bloat for tabulars.
-	return i ? write_attribute(name, convert<string>(i)) : string();
-}
-
-
-template <>
-string const write_attribute(string const & name, Length const & value)
-{
-	// we write only the value if we really have one same reson as above.
-	return value.zero() ? string() : write_attribute(name, value.asString());
-}
-
-
 string const tostr(LyXAlignment const & num)
 {
 	switch (num) {
@@ -503,6 +447,61 @@ void l_getline(istream & is, string & str)
 	}
 }
 
+template <class T>
+string const write_attribute(string const & name, T const & t)
+{
+	string const s = tostr(t);
+	return s.empty() ? s : " " + name + "=\"" + s + "\"";
+}
+
+template <>
+string const write_attribute(string const & name, string const & t)
+{
+	return t.empty() ? t : " " + name + "=\"" + t + "\"";
+}
+
+
+template <>
+string const write_attribute(string const & name, docstring const & t)
+{
+	return t.empty() ? string() : " " + name + "=\"" + to_utf8(t) + "\"";
+}
+
+
+template <>
+string const write_attribute(string const & name, bool const & b)
+{
+	// we write only true attribute values so we remove a bit of the
+	// file format bloat for tabulars.
+	return b ? write_attribute(name, convert<string>(b)) : string();
+}
+
+
+template <>
+string const write_attribute(string const & name, int const & i)
+{
+	// we write only true attribute values so we remove a bit of the
+	// file format bloat for tabulars.
+	return i ? write_attribute(name, convert<string>(i)) : string();
+}
+
+
+template <>
+string const write_attribute(string const & name, Tabular::idx_type const & i)
+{
+	// we write only true attribute values so we remove a bit of the
+	// file format bloat for tabulars.
+	return i ? write_attribute(name, convert<string>(i)) : string();
+}
+
+
+template <>
+string const write_attribute(string const & name, Length const & value)
+{
+	// we write only the value if we really have one same reson as above.
+	return value.zero() ? string() : write_attribute(name, value.asString());
+}
+
 } // namespace
 
 
-- 
1.7.4.4

Reply via email to