public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55992] New: constexpr static member function not recognised in templated using statement
@ 2013-01-15 16:02 wd11 at leicester dot ac.uk
  2013-01-15 22:01 ` [Bug c++/55992] " daniel.kruegler at googlemail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: wd11 at leicester dot ac.uk @ 2013-01-15 16:02 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55992
           Summary: constexpr static member function not recognised in
                    templated using statement
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wd11@leicester.ac.uk


The compiler fails to resolve a static constexpr member function which is used
in a templated using directive. For example, the following valid code
---------------------------------------------------------------------------------
#include <array>

template<unsigned MaxP, typename Type>
struct test
{
  static constexpr unsigned pole(unsigned P)
  { return P>MaxP? MaxP:P; }

  template<unsigned P>
  using my_array = std::array<Type,pole(P)>;    // causing error

  template<unsigned P>
  void do_something(my_array<P> const&, my_array<P>);
};
---------------------------------------------------------------------------------
produces (when compiling via g++ -c -std=c++11 test.cc using gcc 4.7.1 or
4.7.2)
---------------------------------------------------------------------------------
test.cc:10:42: error: ‘pole’ was not declared in this scope
---------------------------------------------------------------------------------
The compiler can be made happy by explicitly resolving ("test::pole" in line
10) or by not using my_array<> (ie. without the do_something() member)


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
@ 2013-01-15 22:01 ` daniel.kruegler at googlemail dot com
  2013-01-15 22:05 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-01-15 22:01 UTC (permalink / raw)
  To: gcc-bugs


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

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> 2013-01-15 22:01:16 UTC ---
Reduced example (free of library stuff):

template<unsigned N>
struct A {};

template<unsigned MaxP>
struct test
{
  static constexpr unsigned pole(unsigned P)
  { return P>MaxP? MaxP:P; }

  template<unsigned P>
  using my_array = A<pole(P)>;

  template<unsigned P>
  void do_something(my_array<P> const&, my_array<P>);
};

The problem also occurs in gcc 4.8.0 20130113 (experimental)


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
  2013-01-15 22:01 ` [Bug c++/55992] " daniel.kruegler at googlemail dot com
@ 2013-01-15 22:05 ` pinskia at gcc dot gnu.org
  2013-01-23 12:30 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-01-15 22:05 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-01-15
     Ever Confirmed|0                           |1
      Known to fail|                            |4.8.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-01-15 22:04:42 UTC ---
Confirmed, a work around is to do:
  using my_array = A<test::pole(P)>;


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
  2013-01-15 22:01 ` [Bug c++/55992] " daniel.kruegler at googlemail dot com
  2013-01-15 22:05 ` pinskia at gcc dot gnu.org
@ 2013-01-23 12:30 ` paolo.carlini at oracle dot com
  2014-09-26 16:42 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-23 12:30 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-23 12:30:13 UTC ---
Let's add Dodji in CC.


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
                   ` (2 preceding siblings ...)
  2013-01-23 12:30 ` paolo.carlini at oracle dot com
@ 2014-09-26 16:42 ` paolo.carlini at oracle dot com
  2014-11-17 21:39 ` jason at gcc dot gnu.org
  2014-11-18  9:54 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-26 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
An alias declaration seems necessary to trigger the bug, eg doesn't affect:

  template<unsigned P>
  struct my_array : A<pole(P)> { };


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
                   ` (3 preceding siblings ...)
  2014-09-26 16:42 ` paolo.carlini at oracle dot com
@ 2014-11-17 21:39 ` jason at gcc dot gnu.org
  2014-11-18  9:54 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2014-11-17 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
This is actually related to bug 15272, it's another case where treating a
member function found in phase 1 lookup the same as an unbound name causes
problems.


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

* [Bug c++/55992] constexpr static member function not recognised in templated using statement
  2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
                   ` (4 preceding siblings ...)
  2014-11-17 21:39 ` jason at gcc dot gnu.org
@ 2014-11-18  9:54 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-18  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I see... So far I haven't been able to make much progress on c++/15272 itself,
thus feel free to reassign.


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

end of thread, other threads:[~2014-11-18  9:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-15 16:02 [Bug c++/55992] New: constexpr static member function not recognised in templated using statement wd11 at leicester dot ac.uk
2013-01-15 22:01 ` [Bug c++/55992] " daniel.kruegler at googlemail dot com
2013-01-15 22:05 ` pinskia at gcc dot gnu.org
2013-01-23 12:30 ` paolo.carlini at oracle dot com
2014-09-26 16:42 ` paolo.carlini at oracle dot com
2014-11-17 21:39 ` jason at gcc dot gnu.org
2014-11-18  9:54 ` 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).