public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nicolas.werner at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100135] [modules] ICE when using constants in a module
Date: Thu, 05 Oct 2023 20:28:35 +0000	[thread overview]
Message-ID: <bug-100135-4-WABYV3UtCd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100135-4@http.gcc.gnu.org/bugzilla/>

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

Nicolas Werner <nicolas.werner at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nicolas.werner at hotmail dot de

--- Comment #1 from Nicolas Werner <nicolas.werner at hotmail dot de> ---
A more minimal example of the issue here, I think:

export module internalname;

constexpr int radix_16 = 16;

export {
  int foo(int in = radix_16) {
    return in;
  }
}

I *think* this is legal module code and MSVC as well as clang do accept it.
However it is a weird edge case. This also isn't exclusive to default function
arguments, you can trigger the same issue with templates:

export module internalname;

constexpr int radix_16 = 16;

template <class T, auto Param>
inline auto do_from_chars() -> T {
  if (Param > 4) {
    return 5;
  }
  else {
    return 4;
  }
}

export {
  template <class T> struct parse_number {
    auto operator()() -> T {
      return do_from_chars<T, radix_16>();
    }
  };
}

Specifically gcc seems to be overly strict here in how it handles internal
linkage entities, that are required on the call site for default parameters or
template instantiations.

  reply	other threads:[~2023-10-05 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18  9:56 [Bug c++/100135] New: ICE when using constants in a mdoule patrick.kox at commandoregel dot be
2023-10-05 20:28 ` nicolas.werner at hotmail dot de [this message]
2023-10-05 20:51 ` [Bug c++/100135] [modules] ICE when using constants in a module nicolas.werner at hotmail dot de
2024-03-06 20:16 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100135-4-WABYV3UtCd@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).