public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure
@ 2012-01-26 10:44 ethouris at gmail dot com
  2012-01-26 13:03 ` [Bug c++/52008] " rguenth at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-01-26 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52008
           Summary: [C++0x] ICE when adding partial specialization for
                    variadic-templated structure
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ethouris@gmail.com


I found this with the following code:

template <size_t B, typename Type1, typename... Types>
struct tuple_sliced
{
    typedef typename tuple_sliced<B-1, Types...>::type type;
};

template<typename... Types>
struct tuple_sliced<0, Types...>  // <-- line 18
{
    typedef tuple<Types...> type;
};

gcc 4.6 says that it's not implemented to expand "Types..." in the first
structure. With gcc 4.7 I got a message:

tuple.cc:18:8: internal compiler error: in process_partial_specialization, at
cp/pt.c:4398

The master declaration of tuple_sliced passes correctly - however any use of it
will result in infinite recursion when there's no terminal version.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
@ 2012-01-26 13:03 ` rguenth at gcc dot gnu.org
  2012-04-16 16:51 ` jason at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-26 13:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-26
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-26 11:14:14 UTC ---
Confirmed.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
  2012-01-26 13:03 ` [Bug c++/52008] " rguenth at gcc dot gnu.org
@ 2012-04-16 16:51 ` jason at gcc dot gnu.org
  2012-04-17  2:33 ` jason at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-16 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-16 16:51:08 UTC ---
This example is problematic because the partial specialization is not more
specialized than the primary template; we should reject it with an error rather
than crashing.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
  2012-01-26 13:03 ` [Bug c++/52008] " rguenth at gcc dot gnu.org
  2012-04-16 16:51 ` jason at gcc dot gnu.org
@ 2012-04-17  2:33 ` jason at gcc dot gnu.org
  2012-04-17 15:38 ` jason at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17  2:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 02:29:47 UTC ---
Author: jason
Date: Tue Apr 17 02:29:43 2012
New Revision: 186521

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186521
Log:
    PR c++/52008
    * pt.c (process_partial_specialization): Complain about a partial
    specialization with fewer args than primary template parms.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic130.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (2 preceding siblings ...)
  2012-04-17  2:33 ` jason at gcc dot gnu.org
@ 2012-04-17 15:38 ` jason at gcc dot gnu.org
  2012-04-20 13:33 ` ethouris at gmail dot com
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-17 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-17 15:27:31 UTC ---
4.8 will reject the testcase with a more helpful message.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (3 preceding siblings ...)
  2012-04-17 15:38 ` jason at gcc dot gnu.org
@ 2012-04-20 13:33 ` ethouris at gmail dot com
  2012-04-20 15:40 ` paolo.carlini at oracle dot com
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-04-20 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

Michal Malecki <ethouris at gmail dot com> changed:

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

--- Comment #5 from Michal Malecki <ethouris at gmail dot com> 2012-04-20 13:33:35 UTC ---
Hey, guys, not too fast.

Why do you say "it's not more specialized"?

The primary template contains "size_t B" as the first template parameter, and
the specialization puts explicit "0" in this place. According to the standard,
this IS a specialization.

Of course, it works now if you change the terminal definition into:

template<typename Type1, typename... Types>
struct tuple_sliced<0, Type1, Types...>
{
    typedef tuple<Type1, Types...> type;
};

But it's roughly the same - the only difference is that it doesn't manage an
interesting case of slicing to 0 (actually I should change it to 1). Whether
the specialization really matches the primary template, it should be decided
when the variadic parameters are expanded, so if this is correct, the cited one
should be correct, too.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (4 preceding siblings ...)
  2012-04-20 13:33 ` ethouris at gmail dot com
@ 2012-04-20 15:40 ` paolo.carlini at oracle dot com
  2012-04-21  1:48 ` jason at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-20 15:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |SUSPENDED

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-20 15:40:09 UTC ---
The issue isn't whether it's a specialization or not, but whether it's
technically more specialized. I didn't personally check in detail but Jason
argued on the ISO reflector that is not ([c++std-core-21739]). And the reason
why currently other front-ends accept the code is that they pick the primary
for the instantiation. Thus this should be made more explicitly ill-formed in
the standard with a DR. Let's suspend the PR for now.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (5 preceding siblings ...)
  2012-04-20 15:40 ` paolo.carlini at oracle dot com
@ 2012-04-21  1:48 ` jason at gcc dot gnu.org
  2012-04-21 12:07 ` ethouris at gmail dot com
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-21  1:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-21 01:46:29 UTC ---
If you rewrite the test so that the two versions are both partial
specializations:

template <size_t, typename...> struct tuple_sliced;

template <size_t B, typename Type1, typename... Types>
struct tuple_sliced<B, Type1, Types...>
{
    typedef typename tuple_sliced<B-1, Types...>::type type;
};

template<typename... Types>
struct tuple_sliced<0, Types...>  // <-- line 18
{
    typedef tuple<Types...> type;
};

and then you try to instantiate it:

tuple_sliced<1,int,int,int> t;

the instantiation is ambiguous.  The second partial specialization is more
specialized for the first argument "0", but the first partial specialization is
more specialized for the parameter pack, because it requires at least one
argument.  So neither is more specialized than the other, and so in the same
way in the original testcase the partial specialization is not more specialized
than the primary template.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (6 preceding siblings ...)
  2012-04-21  1:48 ` jason at gcc dot gnu.org
@ 2012-04-21 12:07 ` ethouris at gmail dot com
  2012-04-21 13:08 ` jason at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-04-21 12:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Michal Malecki <ethouris at gmail dot com> 2012-04-21 12:06:36 UTC ---
Jason,

There is no better or worse specialization - the first one is a primary
template, not a specialization.

The example of tuple_slice<1, int, int, int> will just not match the
specialization with first argument 0 because, simply, here the first argument
is 1.

I have stated that the parameter pack is itself not a type specification, just
a higher level construct that will be first resolved to the actual list of
arguments and only then checked for anything else. But I'm not exactly sure of
that, so maybe the argument pack specification should undergo specialization
rules by itself.

There are, for me, only two logical methods to solve this problem:

1. The code is accepted, even though it violates the standard a bit; pedantic
flags may turn it off. In particular, the specialization is treated as really a
specialization because it matches the name and all tries to instantiate the
primary template can be redirected to the specialization, as long as it matches
the specialized argument. Both the specialization and the primary template are
considered only after the argument pack is expanded, in which case both will
expand to exactly the same list of arguments - so the "expanded versions" will
have the primary-specialization relationship.

2. The code is rejected the following way: the template specialization
definition is itself rejected because due to not covered explicitly all
explicit parameters (that is, all but parameter pack) this is not considered
template specialization. But the template specialization can only be considered
invalidly defined specialization, if template parameters that are passed to the
template are incorrect according to the template parameter definition in the
primary template.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (7 preceding siblings ...)
  2012-04-21 12:07 ` ethouris at gmail dot com
@ 2012-04-21 13:08 ` jason at gcc dot gnu.org
  2012-04-23 12:39 ` ethouris at gmail dot com
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-21 13:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-21 13:06:10 UTC ---
(In reply to comment #8)
> There is no better or worse specialization - the first one is a primary
> template, not a specialization.

But if it were another partial specialization, it would not be less
specialized, and I think a partial specialization must be more specialized than
a hypothetical partial specialization form of the primary template.

> The example of tuple_slice<1, int, int, int> will just not match the
> specialization with first argument 0 because, simply, here the first argument
> is 1.

Right, that one isn't ambiguous, but then it leads to the instantiation of
tuple_slice<0,int,int> which is.

> 2. The code is rejected the following way: the template specialization
> definition is itself rejected because due to not covered explicitly all
> explicit parameters (that is, all but parameter pack) this is not considered
> template specialization.

Right, because the partial specialization doesn't specialize the Type1
parameter, it is not more specialized than the primary template.

You should rewrite your code the way I did, and then do something to address
the ambiguity; possibly a third partial specialization.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (8 preceding siblings ...)
  2012-04-21 13:08 ` jason at gcc dot gnu.org
@ 2012-04-23 12:39 ` ethouris at gmail dot com
  2012-11-06 19:24 ` daniel.kruegler at googlemail dot com
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-04-23 12:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Michal Malecki <ethouris at gmail dot com> 2012-04-23 12:38:47 UTC ---
(In reply to comment #9)
> (In reply to comment #8)
> > 2. The code is rejected the following way: the template specialization
> > definition is itself rejected because due to not covered explicitly all
> > explicit parameters (that is, all but parameter pack) this is not considered
> > template specialization.
> 
> Right, because the partial specialization doesn't specialize the Type1
> parameter, it is not more specialized than the primary template.

It's not the problem that it's "not more specialized" (because it is, as long
as we state it's correct), but rather that it's not correctly defined partial
specialization.

I have tried to find some confirmation in the C++ standard; I think the
14.5.5/4 should make things clear:

(...)
Specifically, the order of the template arguments is the sequence in which they
appear in the template parameter list.
(...)

There are no specific statements for template specializations in case of
variadic parameters. It's important because there are two theoretical
possibilities:

1. First there happens the parameter pack expansion, and then the potential
specialization is verified against the primary template. This way the
specialization can only be rejected if the resulting parameter list does not
match the primary template.

2. First the potential specialization is verified against the primary template,
and then the parameter pack is expanded. In this case the mentioned code is
invalid because the second definition cannot be considered partial
specialization of the tuple_sliced class.

By literally adhering to this rule in the standard, the #2 solution should be
taken. It would be also hard to apply #1 for templates that are also variadic
(to expand the parameter pack, it must be instantiated, and after
instantiation, specializations can no longer be considered).

So, this code should be rejected already at the place of definition of the
specialization, with the explanation, that the arguments passed to the
specialization must exactly match arguments defined in the primary template
(even if it's a parameter pack).

The only thing I have doubts of is whether this is then correct:

template <class A, typename... V> class X;
template <class B, class C, typename... V> class X<int, B, C, V...>;

According to the cited rule in the standard, it's not - the only allowed would
be <int, V...> or <C, V...>.

> You should rewrite your code the way I did, and then do something to address
> the ambiguity; possibly a third partial specialization.

It's not a problem to rewrite the above code so that it works as expected:

template<bool cond, typename TypeIfSo, typename TypeIfNot>
struct TypeIf { typedef TypeIfNot type; };

template<typename TypeIfSo, typename TypeIfNot>
struct TypeIf<true, TypeIfSo, TypeIfNot> { typedef TypeIfSo type; };

template <size_t B, typename Type1, typename... Types>
struct tuple_sliced
{
        typedef typename
                TypeIf<B==0,
                        tuple<Types...>,
                        tuple_sliced<B-1, Types...>
                >::type type;
};

Important thing is that the initial code, even though incorrect, should result
in correct rejection and error report.


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

* [Bug c++/52008] [C++0x] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (9 preceding siblings ...)
  2012-04-23 12:39 ` ethouris at gmail dot com
@ 2012-11-06 19:24 ` daniel.kruegler at googlemail dot com
  2012-11-06 20:12 ` [Bug c++/52008] [Core/1495] " paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-11-06 19:24 UTC (permalink / raw)
  To: gcc-bugs


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #11 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-11-06 19:23:51 UTC ---
The associated core issue 

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1495

has now ready state, so I think this issue could now be unsuspended


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (10 preceding siblings ...)
  2012-11-06 19:24 ` daniel.kruegler at googlemail dot com
@ 2012-11-06 20:12 ` paolo.carlini at oracle dot com
  2012-11-06 21:05 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-06 20:12 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |NEW
            Summary|[C++0x] ICE when adding     |[Core/1495] ICE when adding
                   |partial specialization for  |partial specialization for
                   |variadic-templated          |variadic-templated
                   |structure                   |structure

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-06 20:12:16 UTC ---
Ok. In such cases, let's remember to add the DR # to the Subject.


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (11 preceding siblings ...)
  2012-11-06 20:12 ` [Bug c++/52008] [Core/1495] " paolo.carlini at oracle dot com
@ 2012-11-06 21:05 ` redi at gcc dot gnu.org
  2012-11-06 23:32 ` ethouris at gmail dot com
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-06 21:05 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-06 21:05:35 UTC ---
if the DR makes it ill-formed and GCC rejects it is this FIXED?


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (12 preceding siblings ...)
  2012-11-06 21:05 ` redi at gcc dot gnu.org
@ 2012-11-06 23:32 ` ethouris at gmail dot com
  2012-11-07  0:09 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-11-06 23:32 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #14 from Michal Malecki <ethouris at gmail dot com> 2012-11-06 23:32:36 UTC ---
(In reply to comment #13)
> if the DR makes it ill-formed and GCC rejects it is this FIXED?

GCC "rejects" it by doing ICE. I don't think this is the right thing that GCC
should do.

My last proposal is: gcc should report error at the place where the wannabe
specialization is defined (comment with "line 18") with something like: "18:
This template specialization does not match the template parameters\n12: of
this class template". I cannot check whether gcc currently fixed to do this, so
I'm sorry if this is behind the current state.


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (13 preceding siblings ...)
  2012-11-06 23:32 ` ethouris at gmail dot com
@ 2012-11-07  0:09 ` redi at gcc dot gnu.org
  2012-11-07  7:18 ` ethouris at gmail dot com
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2012-11-07  0:09 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-07 00:08:48 UTC ---
(In reply to comment #14)
> GCC "rejects" it by doing ICE. I don't think this is the right thing that GCC
> should do.

No it doesn't it gives an error, see comment 4.

> My last proposal is: gcc should report error at the place where the wannabe
> specialization is defined (comment with "line 18") with something like: "18:
> This template specialization does not match the template parameters\n12: of
> this class template". I cannot check whether gcc currently fixed to do this, so
> I'm sorry if this is behind the current state.

t.cc:1:11: error: 'size_t' has not been declared
 template <size_t B, typename Type1, typename... Types>
           ^
t.cc:8:8: error: partial specialization is not more specialized than the
primary template because it replaces multiple parameters with a pack expansion
 struct tuple_sliced<0, Types...>  // <-- line 18
        ^
t.cc:2:8: note: primary template here
 struct tuple_sliced
        ^
t.cc:10:13: error: 'tuple' does not name a type
     typedef tuple<Types...> type;
             ^


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (14 preceding siblings ...)
  2012-11-07  0:09 ` redi at gcc dot gnu.org
@ 2012-11-07  7:18 ` ethouris at gmail dot com
  2012-11-07 11:08 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ethouris at gmail dot com @ 2012-11-07  7:18 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #16 from Michal Malecki <ethouris at gmail dot com> 2012-11-07 07:17:46 UTC ---
(In reply to comment #15)
> (In reply to comment #14)
> > GCC "rejects" it by doing ICE. I don't think this is the right thing that GCC
> > should do.
> 
> No it doesn't it gives an error, see comment 4.
...
> > I'm sorry if this is behind the current state.

In this below, just add #include <tuple> to get rid of undefined symbol errors
:)

> t.cc:1:11: error: 'size_t' has not been declared
>  template <size_t B, typename Type1, typename... Types>
>            ^
> t.cc:8:8: error: partial specialization is not more specialized than the
> primary template because it replaces multiple parameters with a pack expansion
>  struct tuple_sliced<0, Types...>  // <-- line 18
>         ^

And that's what it should be, thanks.

(Would be nice of course, if the part of the message starting from "the primary
template" is another message assigned to the line where the primary template is
defined, but this is just cosmetic :).


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (15 preceding siblings ...)
  2012-11-07  7:18 ` ethouris at gmail dot com
@ 2012-11-07 11:08 ` paolo.carlini at oracle dot com
  2012-11-07 18:34 ` paolo.carlini at oracle dot com
  2013-02-14 21:08 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 11:08 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|jason at gcc dot gnu.org    |
         Resolution|                            |FIXED

--- Comment #17 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 11:08:28 UTC ---
This is fixed for 4.8.0 then.


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (16 preceding siblings ...)
  2012-11-07 11:08 ` paolo.carlini at oracle dot com
@ 2012-11-07 18:34 ` paolo.carlini at oracle dot com
  2013-02-14 21:08 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-11-07 18:34 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fate66260 at gmail dot com

--- Comment #18 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-11-07 18:34:30 UTC ---
*** Bug 50998 has been marked as a duplicate of this bug. ***


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

* [Bug c++/52008] [Core/1495] ICE when adding partial specialization for variadic-templated structure
  2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
                   ` (17 preceding siblings ...)
  2012-11-07 18:34 ` paolo.carlini at oracle dot com
@ 2013-02-14 21:08 ` redi at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: redi at gcc dot gnu.org @ 2013-02-14 21:08 UTC (permalink / raw)
  To: gcc-bugs


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmetcalfe at acm dot org

--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-14 21:08:19 UTC ---
*** Bug 56329 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2013-02-14 21:08 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 10:44 [Bug c++/52008] New: [C++0x] ICE when adding partial specialization for variadic-templated structure ethouris at gmail dot com
2012-01-26 13:03 ` [Bug c++/52008] " rguenth at gcc dot gnu.org
2012-04-16 16:51 ` jason at gcc dot gnu.org
2012-04-17  2:33 ` jason at gcc dot gnu.org
2012-04-17 15:38 ` jason at gcc dot gnu.org
2012-04-20 13:33 ` ethouris at gmail dot com
2012-04-20 15:40 ` paolo.carlini at oracle dot com
2012-04-21  1:48 ` jason at gcc dot gnu.org
2012-04-21 12:07 ` ethouris at gmail dot com
2012-04-21 13:08 ` jason at gcc dot gnu.org
2012-04-23 12:39 ` ethouris at gmail dot com
2012-11-06 19:24 ` daniel.kruegler at googlemail dot com
2012-11-06 20:12 ` [Bug c++/52008] [Core/1495] " paolo.carlini at oracle dot com
2012-11-06 21:05 ` redi at gcc dot gnu.org
2012-11-06 23:32 ` ethouris at gmail dot com
2012-11-07  0:09 ` redi at gcc dot gnu.org
2012-11-07  7:18 ` ethouris at gmail dot com
2012-11-07 11:08 ` paolo.carlini at oracle dot com
2012-11-07 18:34 ` paolo.carlini at oracle dot com
2013-02-14 21:08 ` 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).