https://bugs.llvm.org/show_bug.cgi?id=51544

            Bug ID: 51544
           Summary: [concepts] Can template / constraint functions be
                    inherited?
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangb...@nondot.org
          Reporter: l...@marehr.dialup.fu-berlin.de
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

Hi clang-team,

I'm not sure if this is a defect or standard behaviour, but the following code
compiles with gcc, but not with clang:

```cpp
#include <concepts>

#ifndef MODE
#define MODE 0
#endif

struct base {
#if MODE == 0
  void foo(float target){};
#elif MODE == 1
  template <typename target_t>
  void foo(target_t target){};
#elif MODE == 2
  template <std::floating_point target_t>
  void foo(target_t target){};
#endif
};
struct bar : public base {
  using base::foo;

  template <std::integral target_t>
  void foo(target_t target){};
};
int main() {
  bar f{};
  f.foo(float{});
}

```

https://godbolt.org/z/GGjbqdbvq

MODE  | 0 | 1 | 2 |
------|---|---|---|
gcc   | ✓ | ✓ | ✓ |
clang | ✓ | ✗ | ✗ |
msvc  | ✓ | ✗ | ✗ |

I'm unsure if constructs like this are even allowed.

Thank you!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to