public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103564] New: type-requirement that names a constructor should fail
@ 2021-12-05 15:27 johelegp at gmail dot com
  2021-12-07  1:46 ` [Bug c++/103564] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: johelegp at gmail dot com @ 2021-12-05 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103564
           Summary: type-requirement that names a constructor should fail
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/8dr9oG4Y1.

```C++
template<class T> concept C =
  requires { typename T::base; };

struct base { };

static_assert(C<base>);
```

Clang rejects with:
```
<source>:6:1: error: static_assert failed
static_assert(C<base>);
^             ~~~~~~~
<source>:6:15: note: because 'base' does not satisfy 'C'
static_assert(C<base>);
              ^
<source>:2:26: note: because 'typename T::base' would be invalid: ISO C++
specifies that qualified reference to 'base' is a constructor name rather than
a type in this context, despite preceding 'typename' keyword
  requires { typename T::base; };
                         ^
1 error generated.
```

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

* [Bug c++/103564] type-requirement that names a constructor should fail
  2021-12-05 15:27 [Bug c++/103564] New: type-requirement that names a constructor should fail johelegp at gmail dot com
@ 2021-12-07  1:46 ` pinskia at gcc dot gnu.org
  2021-12-07  1:47 ` pinskia at gcc dot gnu.org
  2021-12-07  1:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, this is not really concept related, because GCC/ICC/MSVC all accept the
following too:
struct base { };

template<class T>
void f(void)
{
  typename T::base a;
};
int main(void)
{
  f<base>();
}

--- CUT ----
While clang rejects it.

Maybe there is defect report in this area.

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

* [Bug c++/103564] type-requirement that names a constructor should fail
  2021-12-05 15:27 [Bug c++/103564] New: type-requirement that names a constructor should fail johelegp at gmail dot com
  2021-12-07  1:46 ` [Bug c++/103564] " pinskia at gcc dot gnu.org
@ 2021-12-07  1:47 ` pinskia at gcc dot gnu.org
  2021-12-07  1:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1) 
> Maybe there is defect report in this area.

Note even the original testcase MSVC accepts too.

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

* [Bug c++/103564] type-requirement that names a constructor should fail
  2021-12-05 15:27 [Bug c++/103564] New: type-requirement that names a constructor should fail johelegp at gmail dot com
  2021-12-07  1:46 ` [Bug c++/103564] " pinskia at gcc dot gnu.org
  2021-12-07  1:47 ` pinskia at gcc dot gnu.org
@ 2021-12-07  1:48 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-07  1:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 34810.

*** This bug has been marked as a duplicate of bug 34810 ***

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

end of thread, other threads:[~2021-12-07  1:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05 15:27 [Bug c++/103564] New: type-requirement that names a constructor should fail johelegp at gmail dot com
2021-12-07  1:46 ` [Bug c++/103564] " pinskia at gcc dot gnu.org
2021-12-07  1:47 ` pinskia at gcc dot gnu.org
2021-12-07  1:48 ` 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).