public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47436] New: Variadic base-specifier-list of union rejected
@ 2011-01-24 14:47 schaub.johannes at googlemail dot com
  2011-08-22 22:57 ` [Bug c++/47436] " daniel.kruegler at googlemail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-01-24 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Variadic base-specifier-list of union rejected
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


GCC doesn't accept this

  template<typename ...T> union A : T... { };
  A<> a;

It complains at parse time of "A" about "error: derived union 'A<T>' invalid".
However it doesn't know at that time whether or not the union will have bases
yet when instantiated.


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

* [Bug c++/47436] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
@ 2011-08-22 22:57 ` daniel.kruegler at googlemail dot com
  2011-09-22 18:12 ` [Bug c++/47436] [C++0x] " paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-08-22 22:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-08-22 22:26:07 UTC ---
Based on the FDIS wording (14.6 p. 8) this example should be ill-formed. But
maybe the diagnostic could be improved?


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
  2011-08-22 22:57 ` [Bug c++/47436] " daniel.kruegler at googlemail dot com
@ 2011-09-22 18:12 ` paolo.carlini at oracle dot com
  2011-09-22 18:16 ` daniel.kruegler at googlemail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-22 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Variadic                    |[C++0x] Variadic
                   |base-specifier-list of      |base-specifier-list of
                   |union rejected              |union rejected

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-22 18:02:45 UTC ---
Suggestions about a better error message? (should be easy to change)


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
  2011-08-22 22:57 ` [Bug c++/47436] " daniel.kruegler at googlemail dot com
  2011-09-22 18:12 ` [Bug c++/47436] [C++0x] " paolo.carlini at oracle dot com
@ 2011-09-22 18:16 ` daniel.kruegler at googlemail dot com
  2011-09-22 19:20 ` schaub.johannes at googlemail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-09-22 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2011-09-22 18:11:24 UTC ---
(In reply to comment #2)
> Suggestions about a better error message? (should be easy to change)

What about:

"error: every valid template specialization requires an empty template
parameter pack"

? I don't know how much local information is available, if there is more
available, so following would be better:

"error: every valid specialization of template A requires an empty template
parameter pack T"


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
                   ` (2 preceding siblings ...)
  2011-09-22 18:16 ` daniel.kruegler at googlemail dot com
@ 2011-09-22 19:20 ` schaub.johannes at googlemail dot com
  2011-09-22 19:28 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: schaub.johannes at googlemail dot com @ 2011-09-22 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Johannes Schaub <schaub.johannes at googlemail dot com> 2011-09-22 19:01:51 UTC ---
(In reply to comment #3)
> (In reply to comment #2)
> > Suggestions about a better error message? (should be easy to change)
> 
> What about:
> 
> "error: every valid template specialization requires an empty template
> parameter pack"
> 
> ? I don't know how much local information is available, if there is more
> available, so following would be better:
> 
> "error: every valid specialization of template A requires an empty template
> parameter pack T"

Hmm, this is very technical though. When the user wrote that code, most
probably they either don't want an union, but a class/struct, or they don't
want to derive from something. 

For the tiny fraction of users that *do* want to write that exact code, they
most probably expect it to be valid because they most probably think that if T
is empty, it will expand to nothing. 

With the proposed wording of the diagnostics, in both cases the diagnostic is
suboptimal


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
                   ` (3 preceding siblings ...)
  2011-09-22 19:20 ` schaub.johannes at googlemail dot com
@ 2011-09-22 19:28 ` redi at gcc dot gnu.org
  2011-09-22 21:15 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-22 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-22 19:19:21 UTC ---
I'd go for "error: variadic template A<T> is invalid because every valid
specialization requires an empty template parameter pack"

but I'm not sure that would be needed if the original error simply said "error:
unions cannot have base classes" - I think that's clear enough


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
                   ` (4 preceding siblings ...)
  2011-09-22 19:28 ` redi at gcc dot gnu.org
@ 2011-09-22 21:15 ` paolo.carlini at oracle dot com
  2011-09-22 22:17 ` jason at gcc dot gnu.org
  2011-09-22 23:10 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-22 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-22 20:48:59 UTC ---
I'm reading 14.6/8 and I tend to agree with Jon that not mentioning A<T> would
be probably less misleading. However, I'm afraid we have the recurring problem
that, missing caret diagnostics, we want to name something.

Let's see if Jason has an opinion, maybe for now we want to just live with the
current error message...


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
                   ` (5 preceding siblings ...)
  2011-09-22 21:15 ` paolo.carlini at oracle dot com
@ 2011-09-22 22:17 ` jason at gcc dot gnu.org
  2011-09-22 23:10 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-09-22 22:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-09-22 22:05:54 UTC ---
(In reply to comment #6)
> I'm reading 14.6/8 and I tend to agree with Jon that not mentioning A<T> would
> be probably less misleading. However, I'm afraid we have the recurring problem
> that, missing caret diagnostics, we want to name something.

You don't need to name something to give a source location, just use error_at.

> Let's see if Jason has an opinion, maybe for now we want to just live with the
> current error message...

I think the current message is clear enough.  Only people writing compiler
tests are ever going to hit it.


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

* [Bug c++/47436] [C++0x] Variadic base-specifier-list of union rejected
  2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
                   ` (6 preceding siblings ...)
  2011-09-22 22:17 ` jason at gcc dot gnu.org
@ 2011-09-22 23:10 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-22 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-22 22:46:26 UTC ---
Good, let's close this as invalid, then.

Thanks for clarifying the error_at thing, I should give it more thought: I was
under the impression that we tend to avoid (not a strict rule) things like
"error: unions cannot have base classes" because on a given line a lot can
happen (other errors together with good code) and an accurate column number is
anyway less convenient (for sure to a human like me!) than a name.


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

end of thread, other threads:[~2011-09-22 22:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-24 14:47 [Bug c++/47436] New: Variadic base-specifier-list of union rejected schaub.johannes at googlemail dot com
2011-08-22 22:57 ` [Bug c++/47436] " daniel.kruegler at googlemail dot com
2011-09-22 18:12 ` [Bug c++/47436] [C++0x] " paolo.carlini at oracle dot com
2011-09-22 18:16 ` daniel.kruegler at googlemail dot com
2011-09-22 19:20 ` schaub.johannes at googlemail dot com
2011-09-22 19:28 ` redi at gcc dot gnu.org
2011-09-22 21:15 ` paolo.carlini at oracle dot com
2011-09-22 22:17 ` jason at gcc dot gnu.org
2011-09-22 23:10 ` paolo.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).