weird error message

2017-07-01 Thread crimaniak via Digitalmars-d-learn

Just for fun (may be):

code:

auto findModule = execute(["dscanner", "--etags", entry.name]);
enum moduleMask = ctRegex!`module\s+([^;]+)`;
Captures c = findModule.output.matchFirst!(moduleMask);

result (even C++ guys will be impressed):

phobos_imports.d(43): Error: struct std.regex.Captures(R, DIndex 
= size_t) if (isSomeString!R) is used as a type
phobos_imports.d(43): Error: template std.regex.matchFirst cannot 
deduce function from argument types !(StaticRegex(& func, 
Regex([InversionList(CowArray([9u, 14u, 32u, 33u, 133u, 134u, 
160u, 161u, 5760u, 5761u, 8192u, 8203u, 8232u, 8234u, 8239u, 
8240u, 8287u, 8288u, 12288u, 12289u, 3u])), 
InversionList(CowArray([0u, 59u, 60u, 1114112u, 3u]))], 
[Bytecode(2147483757u), Bytecode(2147483759u), 
Bytecode(2147483748u), Bytecode(2147483765u), 
Bytecode(2147483756u), Bytecode(2147483749u), 
Bytecode(2348810240u), Bytecode(2231369729u), 
Bytecode(2348810240u), Bytecode(2248146945u), Bytecode(0u), 
Bytecode(2952790017u), Bytecode(2281701377u), 
Bytecode(2231369729u), Bytecode(2281701377u), 
Bytecode(2248146945u), Bytecode(1u), Bytecode(3019898881u), 
Bytecode(2550136833u)], null, 2u, 0u, 2u, 17u, 0u, 
[CharMatcher(BitTable([15872u, 1u, 0u, 0u]), 
Trie(MultiArray([0LU, 2048LU], [8192LU, 1536LU], 
[281479271743488LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281483566710785LU, 
281479271743489LU, 281479271743489LU, 281479271743491LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743492LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 
281479271743489LU, 281479271743489LU, 281479271743489LU, 

Weird error message.

2015-08-16 Thread Warwick via Digitalmars-d-learn
Dont know what to make of this, I pretty much get it every other 
time I call rdmd. It'll alternate between running fine and then 
giving me this error...


C:\Program Files (x86)\Notepad++>rdmd J:\Code\statproc.d
std.process.ProcessException@std\process.d(550): Failed to spawn 
new process (The process cannot access the file because

 it is being used by another process.)

0x00434C59
0x00426F47
0x00403C9C
0x00403D17
0x0042F60B
0x0042F521
0x0042258C
0x76B533CA in BaseThreadInitThunk
0x775A9ED2 in RtlInitializeExceptionChain
0x775A9EA5 in RtlInitializeExceptionChain

Any ideas?


Re: weird error message

2017-07-01 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 1 July 2017 at 22:44:33 UTC, crimaniak wrote:

enum moduleMask = ctRegex!`module\s+([^;]+)`;


That should be `static`, not `enum`. I betcha that will at least 
change the error.


Re: weird error message

2017-07-01 Thread Ali Çehreli via Digitalmars-d-learn

On 07/01/2017 03:44 PM, crimaniak wrote:

> Captures c = findModule.output.matchFirst!(moduleMask);
>
> result (even C++ guys will be impressed):
>
> phobos_imports.d(43): Error: struct std.regex.Captures(R, DIndex =
> size_t) if (isSomeString!R) is used as a type

From the error message, it looks like Captures is a template. You can't 
use it as a type simply as 'Captures'. Better use 'auto' in its place:


auto c = /* ... */

Ali



Re: weird error message

2017-07-01 Thread crimaniak via Digitalmars-d-learn

On Saturday, 1 July 2017 at 22:46:06 UTC, Adam D. Ruppe wrote:

On Saturday, 1 July 2017 at 22:44:33 UTC, crimaniak wrote:

enum moduleMask = ctRegex!`module\s+([^;]+)`;


That should be `static`, not `enum`. I betcha that will at 
least change the error.


Works both variants, and reason really in line with Captures c = 
..., as mentioned Ali Çehreli.  But my message not about this 
mistake (I fix it immediately), but about very long error 
messages generated in some cases. Maybe it will be good to have 
some compiler switch or special treatment for messages with so 
very long types.


Re: weird error message

2017-07-01 Thread Ali Çehreli via Digitalmars-d-learn

On 07/01/2017 04:56 PM, crimaniak wrote:

> about very long error messages generated in some
> cases.

Please submit a bug report. The compiler may be able to abbreviate 
certain types. For example, in this case most of the error message text 
is values of a static array elements.


Ali



Re: weird error message

2017-07-02 Thread drug via Digitalmars-d-learn

02.07.2017 04:06, Ali Çehreli пишет:

On 07/01/2017 04:56 PM, crimaniak wrote:

 > about very long error messages generated in some
 > cases.

Please submit a bug report. The compiler may be able to abbreviate 
certain types. For example, in this case most of the error message text 
is values of a static array elements.


Ali

I had error messages 256K+ length in case of complex templates. That's 
was really annoying but I've managed)


Re: weird error message

2017-07-05 Thread crimaniak via Digitalmars-d-learn

On Sunday, 2 July 2017 at 01:06:29 UTC, Ali Çehreli wrote:

On 07/01/2017 04:56 PM, crimaniak wrote:

> about very long error messages generated in some
> cases.

Please submit a bug report. The compiler may be able to 
abbreviate certain types. For example, in this case most of the 
error message text is values of a static array elements.


Done: https://issues.dlang.org/show_bug.cgi?id=17599


Re: Weird error message.

2015-08-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 16, 2015 21:32:08 Warwick via Digitalmars-d-learn wrote:
> Dont know what to make of this, I pretty much get it every other
> time I call rdmd. It'll alternate between running fine and then
> giving me this error...
>
> C:\Program Files (x86)\Notepad++>rdmd J:\Code\statproc.d
> std.process.ProcessException@std\process.d(550): Failed to spawn
> new process (The process cannot access the file because
>   it is being used by another process.)
> 
> 0x00434C59
> 0x00426F47
> 0x00403C9C
> 0x00403D17
> 0x0042F60B
> 0x0042F521
> 0x0042258C
> 0x76B533CA in BaseThreadInitThunk
> 0x775A9ED2 in RtlInitializeExceptionChain
> 0x775A9EA5 in RtlInitializeExceptionChain
>
> Any ideas?

Well, Windows has file locks, so tyically, if one program has a file open,
another can't have it open. So, I'd guess that either something has the file
open when you're running rdmd, so rdmd can't access it, or rdmd is trying to
access it from multiple processes and sometimes one of its processes is
accessing it when another one tries to. But I don't know if rdmd creates
multiple processes or not.

Personally, I wish that Windows didn't have file locks... :(

- Jonathan M Davis



Re: Weird error message.

2015-08-16 Thread BBasile via Digitalmars-d-learn

On Monday, 17 August 2015 at 00:00:11 UTC, Jonathan M Davis wrote:
On Sunday, August 16, 2015 21:32:08 Warwick via 
Digitalmars-d-learn wrote:
Dont know what to make of this, I pretty much get it every 
other time I call rdmd. It'll alternate between running fine 
and then giving me this error...


C:\Program Files (x86)\Notepad++>rdmd J:\Code\statproc.d
std.process.ProcessException@std\process.d(550): Failed to 
spawn

new process (The process cannot access the file because
  it is being used by another process.)
[...]
Any ideas?


Well, Windows has file locks, so tyically, if one program has a 
[...]

Personally, I wish that Windows didn't have file locks... :(


It's locked unless it's specified during the call to 
`CreateFile()` that the file can be shared for reading/writing 
(FILE_SHARE_READ / FILE_SHARE_WRITE).






Re: Weird error message.

2015-08-17 Thread Kagamin via Digitalmars-d-learn

On Sunday, 16 August 2015 at 21:32:10 UTC, Warwick wrote:
Dont know what to make of this, I pretty much get it every 
other time I call rdmd. It'll alternate between running fine 
and then giving me this error...

Any ideas?


rdmd creates an executable and runs it immediately. If you have 
an antivirus, it may not complete its job in this rather short 
timeframe. Just run it again, AFAIK, rdmd caches the executable 
from the last compilation.


On Monday, 17 August 2015 at 00:00:11 UTC, Jonathan M Davis wrote:

Personally, I wish that Windows didn't have file locks... :(


My guess, it's the executable file, which is opened by another 
process, if it's not completely written, running it would give 
even more funny results :)


Re: Weird error message.

2015-08-17 Thread Kagamin via Digitalmars-d-learn

On Monday, 17 August 2015 at 03:14:24 UTC, BBasile wrote:
It's locked unless it's specified during the call to 
`CreateFile()` that the file can be shared for reading/writing 
(FILE_SHARE_READ / FILE_SHARE_WRITE).


And the executable file being run must not be shared for writing, 
because it's mapped.


Re: Weird error message.

2015-08-18 Thread Warwick via Digitalmars-d-learn
Decided to do a fresh install of windows, and problem has one 
away. It seems no matter how careful you are to keep your system 
lean and clean windows eventually starts grinding gears.


Thanks,


Structs as template parameters: weird error message

2015-04-02 Thread biozic via Digitalmars-d-learn

The code below doesn't compile. Why this error message?
---
struct Item {
int i;
}

struct Params {
Item* item;

this(int i) {
item = new Item(i);  // line 9
}
}

struct Foo(Params params) {}

enum foo = Foo!(Params(1));
---

test.d(9): Error: Item(1) is not an lvalue


Re: Structs as template parameters: weird error message

2015-04-02 Thread Nicholas Wilson via Digitalmars-d-learn

On Thursday, 2 April 2015 at 23:12:25 UTC, biozic wrote:

The code below doesn't compile. Why this error message?
---
struct Item {
int i;
}

struct Params {
Item* item;

this(int i) {
item = new Item(i);  // line 9
}
}

struct Foo(Params params) {}

enum foo = Foo!(Params(1));
---

test.d(9): Error: Item(1) is not an lvalue


this doesn't work because struct Foo is parameterised by in 
instance of Params. (like if you were implementing a fixed size 
array: struct FixedSizeArray(size_t len) {...}. here 
FixedSizeArray is parameterised by in instance of a size_t).


Item is a pointer in Params and thus if it were to compile the 
compiler would need to know the value returned by `new`at compile 
time.


There are two ways to get that to compile change `Item* item;` to 
`Item item;` or change `item = new Item(1);` to `item = null;`


tl;dr you can't have r-value (pointers) in instance template 
parameter lists.
i.e. struct foo(my_reference_type_or_type_containg_pointers 
instance) { ... }