`ref T` should be a type!!

Rubn where at is.this
Mon Apr 1 23:43:40 UTC 2019


On Monday, 1 April 2019 at 20:37:03 UTC, Walter Bright wrote:
> On 4/1/2019 6:09 AM, Dein wrote:
>> Not sure if you are trying to just deceive me with some syntax 
>> sugar in C++ or what.
>
> You can try it yourself:
>
> ----------
> g++ -c test.cpp
> test.cpp:1:17: error: cannot declare pointer to int&
>  void test(int&* p);
>                  ^
> ----------
>  g++ -c test.cpp
> test.cpp:1:18: error: declaration of p as array of references
>  void test(int& p[]);
>                   ^
> ----------

You can try it yourself:

void foo(int* const p) {}
void foo(int p[]) {}
-----------------------------------------------
test.cpp:3:6: error: redefinition of 'foo'
void foo(int p[]) {}
      ^
test.cpp:2:6: note: previous definition is here
void foo(int* const p) {}
      ^
1 error generated.


More information about the Digitalmars-d mailing list