public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94844] New: Simple nonsensical program accepted by g++ (rejected by clang++)
@ 2020-04-29  9:07 robert at ocallahan dot org
  2020-04-29  9:18 ` [Bug c++/94844] " redi at gcc dot gnu.org
  2020-04-30  7:06 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: robert at ocallahan dot org @ 2020-04-29  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94844
           Summary: Simple nonsensical program accepted by g++ (rejected
                    by clang++)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: robert at ocallahan dot org
  Target Milestone: ---

Testcase:

#include <stdio.h>
template <typename T> void func(T s) {
  if (s < 0) {
    puts("WHAT");
  }
}
typedef long unsigned Foo;
int main(void) {
  func<long Foo>(-1);
}

g++ (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2):
compiles it and generates code that prints "WHAT".

clang version 9.0.1 (Fedora 9.0.1-2.fc31):
rejects it:
/home/roc/tmp/test.cc:9:13: error: type-id cannot have a name
  func<long Foo>(-1);
            ^~~

clang++ looks right to me. It doesn't seem right to allow 'unsigned' to modify
'Foo' here. Doing that in a variable declaration is rejected.

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

end of thread, other threads:[~2020-04-30  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29  9:07 [Bug c++/94844] New: Simple nonsensical program accepted by g++ (rejected by clang++) robert at ocallahan dot org
2020-04-29  9:18 ` [Bug c++/94844] " redi at gcc dot gnu.org
2020-04-30  7: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).