public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56749] New: weird interaction between scoped enum used as non-type template parameter and template lookup
@ 2013-03-26 22:22 abigagli at gmail dot com
  2013-03-26 23:16 ` [Bug c++/56749] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: abigagli at gmail dot com @ 2013-03-26 22:22 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56749
           Summary: weird interaction between scoped enum used as non-type
                    template parameter and template lookup
    Classification: Unclassified
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abigagli@gmail.com


Hi, g++-4.81 built from svn r197010 on x86_64-apple-darwin12.3.0 with clang3.2.
I find the following unexpected:


enum normal_enum
{
    not_scoped1,
    not_scoped2
};

enum class scoped_enum
{
    scoped1,
    scoped2
};

template <normal_enum N=not_scoped1>
class A
{
public:
    template <typename T>
        void fun ()
        {
        }
};

template <scoped_enum N=scoped_enum::scoped1>
class B
{
public:
    template <typename T>
        void fun ()
        {
        }
};


template <typename T>
void tfun ()
{
    A<> a;
    a.fun<char>(); <------------ THIS IS FINE

    B<> b_defaulted;
    B<scoped_enum::scoped1> b_explicited;

    //b_defaulted.fun<char>();          <------------ UNEXPECTED: THIS FAILS 
    b_defaulted.template fun<char>();   <------------ THIS IS FINE

    //b_explicited.fun<char>();         <------------ UNEXPECTED: THIS FAILS 
    b_explicited.template fun<char>();  <------------ THIS IS FINE
}

int main(int argc, char const *argv[])
{
    tfun<int>();
    return 0;
}


IOW, it seems like using a scoped enum as a non-type template for a class,
induces  a requirement for template disambiguation when invoking a member
template which is not happpening using an normal enum.
Note that neither gcc 4.7.2 nor clang have this behavior.
I assume this is not expected, as I would say "fun" is never a dependent name
in the snippet above as neither a, b_defaulted and b_eplicited are, regardless
of using a scoped enum or a normal enum as the non-type template.

Regards,
Andrea Bigagli.


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

* [Bug c++/56749] [4.8/4.9 Regression] weird interaction between scoped enum used as non-type template parameter and template lookup
  2013-03-26 22:22 [Bug c++/56749] New: weird interaction between scoped enum used as non-type template parameter and template lookup abigagli at gmail dot com
@ 2013-03-26 23:16 ` paolo.carlini at oracle dot com
  2013-03-27 13:37 ` jason at gcc dot gnu.org
  2013-03-29 18:38 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-26 23:16 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-26
            Summary|weird interaction between   |[4.8/4.9 Regression] weird
                   |scoped enum used as         |interaction between scoped
                   |non-type template parameter |enum used as non-type
                   |and template lookup         |template parameter and
                   |                            |template lookup
     Ever Confirmed|0                           |1


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

* [Bug c++/56749] [4.8/4.9 Regression] weird interaction between scoped enum used as non-type template parameter and template lookup
  2013-03-26 22:22 [Bug c++/56749] New: weird interaction between scoped enum used as non-type template parameter and template lookup abigagli at gmail dot com
  2013-03-26 23:16 ` [Bug c++/56749] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
@ 2013-03-27 13:37 ` jason at gcc dot gnu.org
  2013-03-29 18:38 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-27 13:37 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.1


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

* [Bug c++/56749] [4.8/4.9 Regression] weird interaction between scoped enum used as non-type template parameter and template lookup
  2013-03-26 22:22 [Bug c++/56749] New: weird interaction between scoped enum used as non-type template parameter and template lookup abigagli at gmail dot com
  2013-03-26 23:16 ` [Bug c++/56749] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
  2013-03-27 13:37 ` jason at gcc dot gnu.org
@ 2013-03-29 18:38 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-29 18:38 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-29 18:38:44 UTC ---
Fixed for 4.8.1.


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

end of thread, other threads:[~2013-03-29 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 22:22 [Bug c++/56749] New: weird interaction between scoped enum used as non-type template parameter and template lookup abigagli at gmail dot com
2013-03-26 23:16 ` [Bug c++/56749] [4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-03-27 13:37 ` jason at gcc dot gnu.org
2013-03-29 18:38 ` jason 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).