How to correctly apply JUCE_DEPRECATED_WITH_BODY to function template?

Is there a way to do this cross platform compatible? I tried it like

template <typename T>
JUCE_DEPRECATED_WITH_BODY (void foo (Bar<T>& bar),
    // function body here

Which results in a warning like (48, 1) GCC does not allow 'deprecated' attribute in this position on a function definition when compiling with clang. Haven’t even tried it with MSVC.

template<typename T> 
void foo(Bar<T>& bar) {
   // function body here 

Should work. Compiles on godbolt for msvc at least. That’s in the C++14 standard iirc

1 Like

Ah totally forgot about that C++14 deprecated attribute :man_facepalming: Thanks!