https://llvm.org/bugs/show_bug.cgi?id=31624
Bug ID: 31624 Summary: static method invocation via objects are not considered constexpr Product: clang Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++14 Assignee: unassignedclangb...@nondot.org Reporter: m...@godbolt.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified Consider the following (unusual) code: struct Foo { static constexpr bool hasBar() { return true; } }; void test(const Foo &f) { static_assert(Foo::hasBar(), ""); // -is ok static_assert(f.hasBar(), ""); // fails on clang trunk 291576, works in GCC } (also on https://godbolt.org/g/qwzYvc ) All clang versions I tested it on fail with "error: static_assert expression is not an integral constant expression". GCC and CL both allow this and consider the call to the static method hasBar via the actual object f to be constexpr. It's not clear to me which behaviour is correct, though instinctively I'd imagine it to be valid to allow such calls as constexpr. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs