public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40055]  New: Failing instantiation of template with enums
@ 2009-05-07  9:43 alexandre dot hamez at gmail dot com
  2009-05-07  9:45 ` [Bug c++/40055] " alexandre dot hamez at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: alexandre dot hamez at gmail dot com @ 2009-05-07  9:43 UTC (permalink / raw)
  To: gcc-bugs

The  following code failed with the message (no options are given to the
compiler): 

instance.cc: In function 'int main()':
instance.cc:30: error: no matching function for call to 'c_struct<a_tags,
a_struct>::c_struct(a0_type&)'
instance.cc:14: note: candidates are: c_struct<a_tags,
a_struct>::c_struct(const c_struct<a_tags, a_struct>&)

---------------------------------------

enum a_tags { A0, A1 };
enum b_tags { B0, B1 };

template < a_tags Tag >
struct a_struct
{};

template < b_tags Tag >
struct b_struct
{};

template < typename tags, template < tags > class Element >
struct c_struct
{
  template < tags Tag >
  c_struct(Element< Tag >)
  {}
};

typedef c_struct< a_tags, a_struct > a_type;
typedef c_struct< b_tags, b_struct > b_type;
typedef a_struct< A0 > a0_type;
typedef b_struct< B0 > b0_type;

int main()
{
  a0_type a0;
  b0_type b0;
  b_type b_instance(b0);
  a_type a_instance(a0);
}

------------------------------

But if one of the line:
    b_type b_instance(b0);
    a_type a_instance(a0);
is commented out, then the compilation succeeds.

---------------------------
My g++ version, although I've been able to reproduce this bug with older
versions of gcc:
% /usr/local/env/gcc-4.4.0/bin/g++ -v 
Using built-in specs.
Target: i386-apple-darwin9.6.0
Configured with: ../gcc-4.4.0/configure --prefix=/usr/local/env/gcc-4.4.0
--disable-nls --enable-languages=c,c++
Thread model: posix
gcc version 4.4.0 (GCC)


-- 
           Summary: Failing instantiation of template with enums
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alexandre dot hamez at gmail dot com
 GCC build triplet: i386-apple-darwin9.6.0
  GCC host triplet: i386-apple-darwin9.6.0
GCC target triplet: i386-apple-darwin9.6.0


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


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

* [Bug c++/40055] Failing instantiation of template with enums
  2009-05-07  9:43 [Bug c++/40055] New: Failing instantiation of template with enums alexandre dot hamez at gmail dot com
@ 2009-05-07  9:45 ` alexandre dot hamez at gmail dot com
  2009-06-03 21:29 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: alexandre dot hamez at gmail dot com @ 2009-05-07  9:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from alexandre dot hamez at gmail dot com  2009-05-07 09:45 -------
Created an attachment (id=17816)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17816&action=view)
Associated temporary file


-- 


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


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

* [Bug c++/40055] Failing instantiation of template with enums
  2009-05-07  9:43 [Bug c++/40055] New: Failing instantiation of template with enums alexandre dot hamez at gmail dot com
  2009-05-07  9:45 ` [Bug c++/40055] " alexandre dot hamez at gmail dot com
@ 2009-06-03 21:29 ` fxcoudert at gcc dot gnu dot org
  2009-12-25 22:16 ` paolo dot carlini at oracle dot com
  2009-12-25 22:17 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-06-03 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2009-06-03 21:29 -------
Not target-specific, can reproduce on x86_64-linux (don't know what you expect,
though).


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|i386-apple-darwin9.6.0      |
   GCC host triplet|i386-apple-darwin9.6.0      |
 GCC target triplet|i386-apple-darwin9.6.0      |


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


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

* [Bug c++/40055] Failing instantiation of template with enums
  2009-05-07  9:43 [Bug c++/40055] New: Failing instantiation of template with enums alexandre dot hamez at gmail dot com
  2009-05-07  9:45 ` [Bug c++/40055] " alexandre dot hamez at gmail dot com
  2009-06-03 21:29 ` fxcoudert at gcc dot gnu dot org
@ 2009-12-25 22:16 ` paolo dot carlini at oracle dot com
  2009-12-25 22:17 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-25 22:16 UTC (permalink / raw)
  To: gcc-bugs



-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal
      Known to fail|                            |4.4.2
      Known to work|                            |4.5.0


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


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

* [Bug c++/40055] Failing instantiation of template with enums
  2009-05-07  9:43 [Bug c++/40055] New: Failing instantiation of template with enums alexandre dot hamez at gmail dot com
                   ` (2 preceding siblings ...)
  2009-12-25 22:16 ` paolo dot carlini at oracle dot com
@ 2009-12-25 22:17 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-12-25 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2009-12-25 22:17 -------
Works in mainline, not a regression, thus closing as fixed.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2009-12-25 22:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-07  9:43 [Bug c++/40055] New: Failing instantiation of template with enums alexandre dot hamez at gmail dot com
2009-05-07  9:45 ` [Bug c++/40055] " alexandre dot hamez at gmail dot com
2009-06-03 21:29 ` fxcoudert at gcc dot gnu dot org
2009-12-25 22:16 ` paolo dot carlini at oracle dot com
2009-12-25 22:17 ` paolo dot carlini at oracle dot com

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).