public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67033] New: [c++11] template argument invalid for integral constant expression beginning with address-of expression
@ 2015-07-27 20:36 ed at catmur dot co.uk
  2015-07-27 20:55 ` [Bug c++/67033] " ed at catmur dot co.uk
  2021-07-29 21:06 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ed at catmur dot co.uk @ 2015-07-27 20:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67033

            Bug ID: 67033
           Summary: [c++11] template argument invalid for integral
                    constant expression beginning with address-of
                    expression
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot co.uk
  Target Milestone: ---

template<bool B> struct S { };
int x;
S<&x == &x> s;
// error: template argument 1 is invalid
//        ^

&x == &x is a valid converted constant expression of type bool.

The problem is that cp_parser_template_argument sees the initial '&' and
decides that the non-type template argument must be the address-of operator
applied to an id-expression; when it fails to reach the end of the template
argument it aborts.

This behavior is valid for <= C++03, where '&' cannot appear in a constant
expression, but C++11 is more relaxed.


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

end of thread, other threads:[~2021-07-29 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 20:36 [Bug c++/67033] New: [c++11] template argument invalid for integral constant expression beginning with address-of expression ed at catmur dot co.uk
2015-07-27 20:55 ` [Bug c++/67033] " ed at catmur dot co.uk
2021-07-29 21:06 ` pinskia 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).