Issue 115521
Summary Incorrect mangling of __bf16 in template parameter with nested namespaces.
Labels new issue
Assignees
Reporter SagarMaheshwari99
    ```
namespace NS1 {

    namespace NS2 {
        struct NS2_struct1 {};
    }

    template<typename tpVal, typename tpVal1>
    class Class1 {};

    template<typename tpVal>
    using Name1 = Class1<tpVal, NS2::NS2_struct1>;
}

template <typename dtype>
void MyFunc(NS1::Name1<dtype>& input) {}

typedef __bf16 bfloat16;

struct bf16_struct {
    short a;
};

int main() {
    NS1::Class1<bfloat16, NS1::NS2::NS2_struct1> input;
 MyFunc<bfloat16>(input);

    NS1::Class1<bf16_struct, NS1::NS2::NS2_struct1> input1;
    MyFunc<bf16_struct>(input1);

 return 0;
}
```

For __bf16 case the mangling comes out to be -
`_Z6MyFuncIu6__bf16EvRN3NS16Class1IT_NS0_3NS211NS2_struct1EEE`

which demangled comes out to be -
`void MyFunc<__bf16>(NS1::Class1<__bf16, __bf16::NS2::NS2_struct1>&)`

which is incorrect, as __bf16 is treated as a namespace here.


For bf16_struct, right mangling is produced -
`_Z6MyFuncI11bf16_structEvRN3NS16Class1IT_NS1_3NS211NS2_struct1EEE`

and the demangling comes out to be -
`void MyFunc<bf16_struct>(NS1::Class1<bf16_struct, NS1::NS2::NS2_struct1>&)`



https://godbolt.org/z/dTWxYbqhM



_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to