Package: g++-4.1
Version: 4.1.1-15
Severity: normal

With attached code,

t.cc: In member function ‘void ThemeMetric<T>::Read() [with T = GoalType]’:
t.cc:32:   instantiated from here
t.cc:22: error: no matching function for call to ‘FromStack(GoalType&)’
t.cc:3: note: candidates are: void LuaHelpers::FromStack(bool&)
t.cc:4: note:                 void LuaHelpers::FromStack(float&)
t.cc:5: note:                 void LuaHelpers::FromStack(int&)

This happens on 3.4 through 4.1.  This error goes away if

 - LuaHelpers::FromStack(GoalType&) is declared above the template,
 - FromStack is removed from the namespace, or "using namespace LuaHelpers"
 - "using namespace LuaHelpers" is used and FromStack is used without
   LuaHelpers:: qualifier (3.4 through 4.0, not 4.1);
 - ThemeMetric<T>::Read() is not virtual;
 - FromStack is a template and each type is a specialization

If this code isn't valid, I'm not seeing why, or why Read being virtual
or FromStack being in a namespace would affect it.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.5
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages g++-4.1 depends on:
ii  gcc-4.1                       4.1.1-15   The GNU C compiler
ii  gcc-4.1-base                  4.1.1-15   The GNU Compiler Collection (base 
ii  libc6                         2.3.6-7    GNU C Library: Shared libraries
ii  libstdc++6-4.1-dev            4.1.1-15   The GNU Standard C++ Library v3 (d

g++-4.1 recommends no packages.

-- no debconf information
namespace LuaHelpers
{
        void FromStack( bool &Object );
        void FromStack( float &Object );
        void FromStack( int &Object );
};

struct IThemeMetric
{
public:
        virtual ~IThemeMetric() { }
        virtual void Read() = 0;
};

template <class T>
struct ThemeMetric : public IThemeMetric
{
public:
        void Read()
        {
                T x;
                LuaHelpers::FromStack(x);
        }
};

enum GoalType { a, b, c };
namespace LuaHelpers
{
        void FromStack( GoalType &o );
};

ThemeMetric<GoalType> EDIT_MODE;

Reply via email to