public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51194] New: ICE about template aliasing
@ 2011-11-17 13:19 fate66260 at gmail dot com
  2011-11-17 17:37 ` [Bug c++/51194] " dodji at seketeli dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fate66260 at gmail dot com @ 2011-11-17 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51194
           Summary: ICE about template aliasing
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fate66260@gmail.com


compiler option: -Wall -std=c++0x
error message:

242:43: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in lookup_template_class_1, at cp/pt.c:7293

code:
/*
  including, boost/mpl/and.hpp
             boost/type_traits/is_same.hpp
 */

template < bool, class T = void >
enable_if_c
{
  typedef T type;
};
template < class T >
enable_if_c<false, T>
{ };

template < class Cond, class T = void >
using enable_if = enable_if_c<Cond::value, T>;

template < template <class...> class... Conds >
struct condition_and
{
  template < class... Types >
  using enable = enable_if<boost::mpl::and_<Conds<Types>...>>;
};

template < class T, class U = T >
using Test = typename condition_and
< 
// For any two parameters meta-functions, same error occurs.
  boost::is_same
, boost::is_same
, boost::is_same
>::template enable<T, U>; // here


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

* [Bug c++/51194] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
@ 2011-11-17 17:37 ` dodji at seketeli dot org
  2011-11-18  9:50 ` fate66260 at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at seketeli dot org @ 2011-11-17 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from dodji at seketeli dot org <dodji at seketeli dot org> 2011-11-17 17:33:28 UTC ---
I could not reproduce the ICE with svn trunk revision r181378.  Here is
what I get:

$ cat -n test.cc
     1    #include <boost/mpl/and.hpp>
     2    #include <boost/type_traits/is_same.hpp>
     3    
     4    template < bool, class T = void >
     5    enable_if_c
     6    {
     7        typedef T type;
     8    };
     9    template < class T >
    10    enable_if_c<false, T>
    11    { };
    12    
    13    template < class Cond, class T = void >
    14    using enable_if = enable_if_c<Cond::value, T>;
    15    
    16    template < template <class...> class... Conds >
    17    struct condition_and
    18    {
    19        template < class... Types >
    20        using enable = enable_if<boost::mpl::and_<Conds<Types>...>>;
    21    };
    22    
    23    template < class T, class U = T >
    24    using Test = typename condition_and
    25    < 
    26        // For any two parameters meta-functions, same error occurs.
    27        boost::is_same
    28        , boost::is_same
    29        , boost::is_same
    30        >::template enable<T, U>; // here
$ g++ -std=c++0x test.cc

test.cc:5:1: erreur: ‘enable_if_c’ does not name a type
test.cc:10:1: erreur: ‘enable_if_c’ does not name a type
test.cc:14:19: erreur: expected type-specifier before ‘enable_if_c’
test.cc:14:19: erreur: expected ‘;’ before ‘enable_if_c’
test.cc:14:19: erreur: ‘enable_if_c’ does not name a type
test.cc:14:19: erreur: mismatched argument pack lengths while expanding
‘Conds<Types>’
$ 

Note that the code is not valid.

If you are still getting an ICE, please provide the pre-processed output
(using the option -save-temps, for instance) so that I can be sure to
use a similar environment as the one you used.

Thanks.


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

* [Bug c++/51194] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
  2011-11-17 17:37 ` [Bug c++/51194] " dodji at seketeli dot org
@ 2011-11-18  9:50 ` fate66260 at gmail dot com
  2011-11-18 15:14 ` [Bug c++/51194] [C++0x] " dodji at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fate66260 at gmail dot com @ 2011-11-18  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from fate66260 at gmail dot com 2011-11-18 08:59:28 UTC ---
http://ideone.com/lZEbs

g++ (GCC) 4.7.0 20111112
g++ -std=c++0x a.cpp
--------------------------------------------------------------------------
a.cpp: In instantiation of 'struct enable_and<is_same, is_same, is_same>':
a.cpp:110:19:   required from here
a.cpp:91:46: error: wrong number of template arguments (1, should be 2)
a.cpp:69:8: error: provided for 'template<class, class> struct is_same'
a.cpp:91:46: error: wrong number of template arguments (1, should be 2)
a.cpp:69:8: error: provided for 'template<class, class> struct is_same'
a.cpp:110:41: internal compiler error: tree check: expected class 'type', have
'
exceptional' (error_mark) in lookup_template_class_1, at cp/pt.c:7293
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
--------------------------------------------------------------------------

Lines 69 and 91,
[C++0x] Inner class alias-definition variadic template error
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51180


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

* [Bug c++/51194] [C++0x] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
  2011-11-17 17:37 ` [Bug c++/51194] " dodji at seketeli dot org
  2011-11-18  9:50 ` fate66260 at gmail dot com
@ 2011-11-18 15:14 ` dodji at gcc dot gnu.org
  2011-11-18 19:49 ` dodji at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-18 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-11-18
                 CC|dodji at gcc dot gnu.org    |
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #3 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-18 15:09:19 UTC ---
Confirmed.  Thanks.


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

* [Bug c++/51194] [C++0x] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
                   ` (2 preceding siblings ...)
  2011-11-18 15:14 ` [Bug c++/51194] [C++0x] " dodji at gcc dot gnu.org
@ 2011-11-18 19:49 ` dodji at gcc dot gnu.org
  2011-11-19 14:57 ` dodji at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-18 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-18 19:18:46 UTC ---
Here is a smaller reproducer:

template<class U, class V>
struct foo {};

template<class U, class V=char>
struct P {};

template<template<class... U> class... TT>
struct bar {
    template<class... Args>
    using mem = P<TT<Args...>...>;
};

bar<foo>::mem<int, char> b;


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

* [Bug c++/51194] [C++0x] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
                   ` (3 preceding siblings ...)
  2011-11-18 19:49 ` dodji at gcc dot gnu.org
@ 2011-11-19 14:57 ` dodji at gcc dot gnu.org
  2011-11-20  7:19 ` dodji at gcc dot gnu.org
  2011-11-20  9:04 ` dodji at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-19 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-19 14:07:22 UTC ---
A candidate patch has been posted to
http://gcc.gnu.org/ml/gcc-patches/2011-11/msg01979.html


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

* [Bug c++/51194] [C++0x] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
                   ` (4 preceding siblings ...)
  2011-11-19 14:57 ` dodji at gcc dot gnu.org
@ 2011-11-20  7:19 ` dodji at gcc dot gnu.org
  2011-11-20  9:04 ` dodji at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-20  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-20 07:10:31 UTC ---
Author: dodji
Date: Sun Nov 20 07:10:24 2011
New Revision: 181523

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181523
Log:
PR c++/51194 - ICE with invalid alias template

gcc/cp/

    PR c++/51194
    * pt.c (lookup_template_class_1): Go out early if the type of the
    template is error_mark_node.

gcc/testsuite/

    PR c++/51194
    * g++.dg/cpp0x/alias-decl-15.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/51194] [C++0x] ICE about template aliasing
  2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
                   ` (5 preceding siblings ...)
  2011-11-20  7:19 ` dodji at gcc dot gnu.org
@ 2011-11-20  9:04 ` dodji at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-11-20  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

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

--- Comment #7 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-11-20 07:11:48 UTC ---
This should be fixed in trunk (4.7) now.


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

end of thread, other threads:[~2011-11-20  7:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-17 13:19 [Bug c++/51194] New: ICE about template aliasing fate66260 at gmail dot com
2011-11-17 17:37 ` [Bug c++/51194] " dodji at seketeli dot org
2011-11-18  9:50 ` fate66260 at gmail dot com
2011-11-18 15:14 ` [Bug c++/51194] [C++0x] " dodji at gcc dot gnu.org
2011-11-18 19:49 ` dodji at gcc dot gnu.org
2011-11-19 14:57 ` dodji at gcc dot gnu.org
2011-11-20  7:19 ` dodji at gcc dot gnu.org
2011-11-20  9:04 ` dodji 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).