bytedeco / javacpp

The missing bridge between Java and native C++
Other
4.48k stars 581 forks source link

ParserException for valid c++ code #719

Closed Centaur closed 10 months ago

Centaur commented 11 months ago
typedef struct X {
    int m;
    X(): m(0){}
} X;

'X(): m(0){}' line causes ParserException: Unexpected token '('

Perhaps duplicate with #406

saudet commented 10 months ago

That seems to be fixed. Here's what I get with JavaCPP 1.5.10-SNAPSHOT:

@NoOffset public static class X extends Pointer {
    static { Loader.load(); }
    /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
    public X(Pointer p) { super(p); }
    /** Native array allocator. Access with {@link Pointer#position(long)}. */
    public X(long size) { super((Pointer)null); allocateArray(size); }
    private native void allocateArray(long size);
    @Override public X position(long position) {
        return (X)super.position(position);
    }
    @Override public X getPointer(long i) {
        return new X((Pointer)this).offsetAddress(i);
    }

    public native int m(); public native X m(int setter);
    public X() { super((Pointer)null); allocate(); }
    private native void allocate();
}