• if constexpr as it should be

    From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Thu Jul 17 14:41:40 2025
    From Newsgroup: comp.lang.c++

    I think if constexpr should be extended in a way that the not compiled
    branch is only syntactically analyzed but not semantically; currently
    this holds true only for generic code. With that you could have opera-
    tions that are only meaningful if that branch is actually compiled.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Marcel Mueller@news.5.maazl@spamgourmet.org to comp.lang.c++ on Thu Jul 17 21:50:18 2025
    From Newsgroup: comp.lang.c++

    Am 17.07.25 um 14:41 schrieb Bonita Montero:
    I think if constexpr should be extended in a way that the not compiled
    branch is only syntactically analyzed but not semantically; currently
    this holds true only for generic code. With that you could have opera-
    tions that are only meaningful if that branch is actually compiled.

    -v

    Do you have an example, that is _not_ working with the current
    implementation?


    Marcel
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Fri Jul 18 08:38:33 2025
    From Newsgroup: comp.lang.c++

    Am 17.07.2025 um 21:50 schrieb Marcel Mueller:
    Am 17.07.25 um 14:41 schrieb Bonita Montero:
    I think if constexpr should be extended in a way that the not compiled
    branch is only syntactically analyzed but not semantically; currently
    this holds true only for generic code. With that you could have opera-
    tions that are only meaningful if that branch is actually compiled.

    -v

    Do you have an example, that is _not_ working with the current implementation?

    If constexpr does ignore semanically invalid code for the inactive
    branch only if it is related to a generic type, i.e. it doesn't make
    a semantical analysis with that. This should be true for the complete
    branch.

    --- Synchronet 3.21a-Linux NewsLink 1.2