Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[BUG] Recognize non-deducible parameter #534

Open

Description

Title: Use cpp2::in for non-deducible parameters.

Description:

Currently, Cppfront doesn't wrap in cpp2::in
a template function $F$'s function parameter
that has the type of one of $F$'s template parameter
to avoid making it non-deducible.

However, it also does the same
when a similar use of $F$'s template parameter
makes the function parameter non-deducible.

If a function parameter is already non-deducible,
its type should be wrapped in cpp2::in.

Minimal reproducer (https://cpp2.godbolt.org/z/jjxTWfcfq):

f: <T> (x: std::integral_constant<i32, T::value>) = { }
main: () = { }
Commands:
cppfront main.cpp2
clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp

Expected result:

template<typename T> auto f(cpp2::in<std::integral_constant<cpp2::i32,T::value>> x) -> void{}

Actual result and error:

template<typename T> auto f(std::integral_constant<cpp2::i32,T::value> const& x) -> void{}
Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================


#include "cpp2util.h"



//=== Cpp2 type definitions and function declarations ===========================

template<typename T> auto f(std::integral_constant<cpp2::i32,T::value> const& x) -> void;
auto main() -> int;


//=== Cpp2 function definitions =================================================

template<typename T> auto f(std::integral_constant<cpp2::i32,T::value> const& x) -> void{}
auto main() -> int{}
Output:
Program returned: 0

Activity

  1. ghost added
    bug
    on Jul 3, 2023
  2. ghost changed the title [-][BUG] Use `cpp2::in` for non-deducible parameters[/-] [+][BUG] Recognize non-deducible parameter[/+] on Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions