public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114804] New: rejects valid code
@ 2024-04-22 13:01 wdehnen64 at gmail dot com
  2024-04-22 13:12 ` [Bug c++/114804] [11/12/13/14 Regression] rejects valid code since r11-6815 jakub at gcc dot gnu.org
  2024-04-22 22:54 ` [Bug c++/114804] [11/12/13/14 Regression] using of a static variable inside a template is not found for use of a base class template of an inner class during instantiation " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: wdehnen64 at gmail dot com @ 2024-04-22 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114804
           Summary: rejects valid code
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wdehnen64 at gmail dot com
  Target Milestone: ---

gcc fails to compile the following

===test.cc===
template<int D> struct blurb 
{ constexpr static int d=D; };

template<typename> struct pant
{ int foo=0; };

template<typename Base>
struct bug : Base
{
    using base = Base;
    using base::d;
    using tool = blurb<d>;
    struct problem : pant<tool> { using pant<tool>::foo; };
    void bar() const { problem b; }
};

template struct bug< blurb<2> >;


===Terminal===
> gcc-13 src/bug.cc -c
src/bug.cc: In instantiation of 'struct bug<blurb<2> >::problem':
src/bug.cc:17:17:   required from here
src/bug.cc:13:12: error: 'd' was not declared in this scope
   13 |     struct problem : pant<tool> { using pant<tool>::foo; };
      |            ^~~~~~~
src/bug.cc:13:53: error: type 'pant<blurb<2> >' is not a base type for type
'bug<blurb<2> >::problem'
   13 |     struct problem : pant<tool> { using pant<tool>::foo; };
      |                                                     ^~~

===Note===
last version known to be correct: gcc-10.5.0 (gcc-11, gcc-12 also fail)

===Version===
> g++-13 -v
Using built-in specs.
COLLECT_GCC=g++-13
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/13.2.0/bin/../libexec/gcc/x86_64-apple-darwin23/13/lto-wrapper
Target: x86_64-apple-darwin23
Configured with: ../configure --prefix=/usr/local/opt/gcc
--libdir=/usr/local/opt/gcc/lib/gcc/current --disable-nls
--enable-checking=release --with-gcc-major-version-only
--enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-13
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 13.2.0'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--with-system-zlib --build=x86_64-apple-darwin23
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Homebrew GCC 13.2.0)

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

* [Bug c++/114804] [11/12/13/14 Regression] rejects valid code since r11-6815
  2024-04-22 13:01 [Bug c++/114804] New: rejects valid code wdehnen64 at gmail dot com
@ 2024-04-22 13:12 ` jakub at gcc dot gnu.org
  2024-04-22 22:54 ` [Bug c++/114804] [11/12/13/14 Regression] using of a static variable inside a template is not found for use of a base class template of an inner class during instantiation " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-22 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |11.5
   Last reconfirmed|                            |2024-04-22
           Priority|P3                          |P2
            Summary|rejects valid code          |[11/12/13/14 Regression]
                   |                            |rejects valid code since
                   |                            |r11-6815
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started to be rejected with r11-6815-g79e1251b642db038df276153c9f2ec6b82e56162

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

* [Bug c++/114804] [11/12/13/14 Regression] using of a static variable inside a template is not found for use of a base class template of an inner class during instantiation since r11-6815
  2024-04-22 13:01 [Bug c++/114804] New: rejects valid code wdehnen64 at gmail dot com
  2024-04-22 13:12 ` [Bug c++/114804] [11/12/13/14 Regression] rejects valid code since r11-6815 jakub at gcc dot gnu.org
@ 2024-04-22 22:54 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-22 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.5.0
      Known to fail|                            |11.1.0
            Summary|[11/12/13/14 Regression]    |[11/12/13/14 Regression]
                   |using of a static variable  |using of a static variable
                   |inside a template is not    |inside a template is not
                   |found during instantiation  |found for use of a base
                   |since r11-6815              |class template of an inner
                   |                            |class during instantiation
                   |                            |since r11-6815

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced a little further:
```
template<int D> struct blurb 
{ constexpr static int d=D; };

template<int> struct pant{};

template<typename Base>
struct bug : Base
{
    using Base::d;
    struct problem : pant<d> {  };
};

template struct bug< blurb<2> >;
```

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

end of thread, other threads:[~2024-04-22 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22 13:01 [Bug c++/114804] New: rejects valid code wdehnen64 at gmail dot com
2024-04-22 13:12 ` [Bug c++/114804] [11/12/13/14 Regression] rejects valid code since r11-6815 jakub at gcc dot gnu.org
2024-04-22 22:54 ` [Bug c++/114804] [11/12/13/14 Regression] using of a static variable inside a template is not found for use of a base class template of an inner class during instantiation " 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).