https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67762

--- Comment #7 from Evgeniy Dushistov <dushistov at mail dot ru> ---
Here simple example extracted from Qt 6 git:

```
template<auto Signal=nullptr>
struct Prop {
    void notify()
    {
            if constexpr (Signal != nullptr) {
            }
    }
};

class QObjectPrivate {
public:
    struct ExtraData
    {
            inline void nameChangedForwarder()  {}
    };
};

int main()
{
        Prop<&QObjectPrivate::ExtraData::nameChangedForwarder>  prop;
        prop.notify();
}

```

"g++ -std=c++17" compiles it just fine,
while "g++ -std=c++17 -fsanitize=undefined" gitves such error:

test2.cpp: In instantiation of 'void Prop<Signal>::notify() [with auto Signal =
&QObjectPrivate::ExtraData::nameChangedForwarder]':
test2.cpp:21:13:   required from here
test2.cpp:5:34: error: '(QObjectPrivate::ExtraData::nameChangedForwarder != 0)'
is not a constant expression
    5 |             if constexpr (Signal != nullptr) {
      |                           ~~~~~~~^~~~~~~~~~


This is with gcc 11.1.0

Reply via email to