[cfe-dev] possible clang bug?
Alex L via cfe-dev
cfe-dev at lists.llvm.org
Wed Jan 11 06:15:43 PST 2017
On 9 January 2017 at 14:59, Adam Burr via cfe-dev <cfe-dev at lists.llvm.org>
wrote:
> This compiles in clang 3.8 but I believe it should not:
>
> template< class T = int >
> struct A
> {
> struct B {};
>
> const B* test (const B* b) const;
> };
>
> template< class T >
> inline auto A< T >::test (const B* const b) const -> const B*
> {
> return ++b;
> }
>
> int main()
> {
> A<> m;
> const A<>::B* b = 0;
> b = m.test (b);
> }
>
>
> Here is the same code in coliru:
>
> http://coliru.stacked-crooked.com/a/55a3a6e7d28e8a5d
>
> gcc reports the error I was expecting:
>
> main.cpp: In instantiation of 'const A<T>::B* A<T>::test(const A<T>::B*)
> const [with T = int]':
> main.cpp:19:18: required from here
> main.cpp:12:9: error: increment of read-only parameter 'b'
> return ++b;
>
>
> This is a very non-critical bug (if it even is a bug) and I do not need a
> fix but I thought I would point it out because I happened to notice.
>
Thanks for reporting this issue!
I've created a bugzilla entry at https://llvm.org/bugs/show_bug.cgi?id=31607
since I didn't find any duplicates.
Alex
> Thanks,
> Adam Burr
> Blue Sky Studios
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170111/beb68863/attachment.html>
More information about the cfe-dev
mailing list