[Bug c++/59342] New: Function Template Specialisation causing compiler error together with using clauses

filipe.c.maia at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Nov 29 13:46:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59342

            Bug ID: 59342
           Summary: Function Template Specialisation causing compiler
                    error together with using clauses
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: filipe.c.maia at gmail dot com

The following code causes a compilation error:

namespace bar
{
  void f(char x){;}
}

namespace foo
{
  // If the using clause is here; no error    
  // using bar::f;
  template <typename T> void f(T x);  
  template <> void f(int x);

  // With the using clause is here; error
  using bar::f;

  template <typename T> void f(T x){; }  
  template <> void f(int x){ ; }
}

g++-4.8 -c namespace_noheader.cpp
namespace_noheader.cpp:17:27: error: 'void foo::f(int)' is not declared in
'foo'
   template <> void f(int x){ ; }
                           ^

I've also tried with newer versions online with the same result.
Moving the using line up makes the problem go away.



More information about the Gcc-bugs mailing list