Skip to content

Instantly share code, notes, and snippets.

@mwotton
Created September 26, 2017 00:26
Show Gist options
  • Save mwotton/094aeb7e4293fab21e8680934027d87c to your computer and use it in GitHub Desktop.
Save mwotton/094aeb7e4293fab21e8680934027d87c to your computer and use it in GitHub Desktop.
Detected errors in 1 module.
-- TYPE MISMATCH ---------------------------------------------------------------
`thestruct` does not have a field named `quuux`.
6| main = text thestruct.quuux
^^^^^^^^^^^^^^^
The type of `thestruct` is:
{ bar : number, quux : String }
Which does not contain a field named `quuux`.
Hint: The record fields do not match up. Maybe you made one of these typos?
quux <-> quuux
set ➜ ~ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
set ➜ ~ g++ test.cpp
test.cpp: In function ‘int main()’:
test.cpp:9:41: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
thestruct s = { .bar = 3, .quux = "c" };
^
test.cpp:10:20: error: ‘thestruct {aka struct foo}’ has no member named ‘quuux’
printf("%s\n", s.quuux);
^
#include <stdio.h>
typedef struct foo {
int bar;
char * quux;
} thestruct;
main() {
thestruct s = { .bar = 3, .quux = "c" };
printf("%s\n", s.quuux);
}
import Html exposing (text)
thestruct = { bar = 1, quux = "c" }
main = text thestruct.quuux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment