Skip to content

one case gcc can compile, but clang will fail to compile #60435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4465464 opened this issue Feb 1, 2023 · 4 comments
Closed

one case gcc can compile, but clang will fail to compile #60435

4465464 opened this issue Feb 1, 2023 · 4 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate

Comments

@4465464
Copy link

4465464 commented Feb 1, 2023

#include <stdio.h>
#include <type_traits>

template <typename T>
constexpr inline bool is_nested(){
    return std::is_same_v<T,int>;
}

template<template <typename> class hash_function>
int device_hasher(){
    return 0;
}

template <typename Key, std::enable_if_t<(not is_nested<Key>())>* = nullptr>
struct SparkMurmurHash3_32{
    using result_type = int;

    constexpr SparkMurmurHash3_32()=default;

    [[nodiscard]] result_type  inline operator()(Key const& key) const{
        return compute(key);
    }
};

int main(){
    device_hasher<SparkMurmurHash3_32>();
    return 0;
}
<source>:27:5: error: no matching function for call to 'device_hasher'
    device_hasher<SparkMurmurHash3_32>();
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:11:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'hash_function'
int device_hasher(){
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Feb 1, 2023
@llvmbot
Copy link
Member

llvmbot commented Feb 1, 2023

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented Feb 1, 2023

I am not sure who is correct here, note MSVC agrees with clang: https://godbolt.org/z/EoMs3qsWq

Maybe @royjacobson might have an idea on this one.

@royjacobson
Copy link
Contributor

Another case of -frelaxed-template-template-args being abandoned, unfortunately :(

#37392

@mizvekov
Copy link
Contributor

Duplicate of #42224

@mizvekov mizvekov marked this as a duplicate of #42224 Apr 27, 2024
@mizvekov mizvekov closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2024
@EugeneZelenko EugeneZelenko added the duplicate Resolved as duplicate label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

6 participants