[cfe-dev] [C++11][initializer list]problem about direct-list-initialization to a function pointer
Richard Smith
richard at metafoo.co.uk
Tue Mar 19 20:36:31 PDT 2013
Thanks for the report, this was a hole in our declaration-statement /
expression-statement disambiguation logic. Fixed in r177480.
On Tue, Mar 19, 2013 at 7:57 PM, ZhangXiongpang <zhangxiongpang at gmail.com>wrote:
> Platform: linux, x86_64, clang 3.2
>
> I met a strange question when testing "initializer list" with clang++.
> It reported error at direct-list-initialization to a function pointer in a
> block scope.
> At the beginning, I guessed clang++ parse it as a function defination.
> Later I found it no longer reported error when I move the
> direct-list-initialization sentence into global scope.
>
> Test code is as follows:
> ------------------------------------------
> struct X {
> void foo() {}
> };
>
> // global scope
> void (*pf1)() {}; // ok
> void (X::*pmf1)() {&X::foo}; // ok
> void (X::*pmf2)() = {&X::foo}; // ok
>
> // block scope
> void test() {
> void (*pf2)() {}; // error
> void (X::*pmf3)() {&X::foo}; // error
> void (X::*pmf4)() = {&X::foo}; // ok
> }
> ------------------------------------------
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/C-11-initializer-list-problem-about-direct-list-initialization-to-a-function-pointer-tp4031054.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130319/11f00a1b/attachment.html>
More information about the cfe-dev
mailing list