public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63268] New: Ambiguous non-specialized static template scope is accepted
@ 2014-09-15  9:54 dak at gnu dot org
  2014-09-15 10:21 ` [Bug c++/63268] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dak at gnu dot org @ 2014-09-15  9:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63268

            Bug ID: 63268
           Summary: Ambiguous non-specialized static template scope is
                    accepted
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dak at gnu dot org

The following code

template <class T>
class Bass {
  T elt;
public:
  static void bing () { }
};

class Deriv : Bass<int>
{
  void boing ()
  {
    Bass::bing ();
  }
};

compiles without warning.  However, Bass::bing, calling a static member
function of a templated class, is ambiguous.  It should be Bass<int>:: or
Bass<float>:: or whatever since being a static member and explicitly resolved
it is no longer tied to the class hierarchy of Deriv and thus it should not
matter that Bass<int> is a base class of Deriv.

I was hit by this when our project did a crosscompilation with an older version
of g++ (no idea about the exact version, but should be in the 4.4 range or so)
and balked at code like this that went unnoticed by g++ 4.8.  Specifying the
template argument class explicitly placated both 4.8 and whatever the older
compiler version was.

I think that the older compiler version was correct rejecting this.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-15 12:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-15  9:54 [Bug c++/63268] New: Ambiguous non-specialized static template scope is accepted dak at gnu dot org
2014-09-15 10:21 ` [Bug c++/63268] " redi at gcc dot gnu.org
2014-09-15 12:09 ` dak at gnu dot org
2014-09-15 12:28 ` redi at gcc dot gnu.org
2014-09-15 12:32 ` redi at gcc dot gnu.org
2014-09-15 12:46 ` dak at gnu dot org
2014-09-15 12:51 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).