Thread: Weird compilation error in call of private function!

  1. #1
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665

    Weird compilation error in call of private function!

    Hi, guys. I'm having some trouble calling a private function from a public one. My compiler errors are pretty vague too. The line in question is line 106

    Here's what I'm getting from a build attempt:
    Code:
    /bin/sh -c '/usr/bin/make -j4 -e -f  Makefile'
    ----------Building project:[ VectorList - Debug ]----------
    make[1]: Entering directory `experimental/VectorList'
    /usr/bin/g++-5  -c  "experimental/VectorList/test/iterator-tests.cpp" -g -O0 -pedantic -W -std=c++14 -Wall  -o ./debug/test_iterator-tests.cpp.o -I. -I.
    /usr/bin/g++-5  -c  "experimental/VectorList/test/utils-tests.cpp" -g -O0 -pedantic -W -std=c++14 -Wall  -o ./debug/test_utils-tests.cpp.o -I. -I.
    /usr/bin/g++-5  -c  "experimental/VectorList/test/vectorlist-tests.cpp" -g -O0 -pedantic -W -std=c++14 -Wall  -o ./debug/test_vectorlist-tests.cpp.o -I. -I.
    In file included from experimental/VectorList/test/test.hpp:8:0,
                     from experimental/VectorList/test/vectorlist-tests.cpp:1:
    experimental/VectorList/test/../include/vectorlist.hpp: In instantiation of 'void regulus::vector_list<T>::increment_size(int) [with T = int]':
    experimental/VectorList/test/../include/vectorlist.hpp:106:21:   required from 'void regulus::vector_list<T>::emplace(Args&& ...) [with Args = {int}; T = int]'
    experimental/VectorList/test/vectorlist-tests.cpp:7:18:   required from here
    experimental/VectorList/test/../include/vectorlist.hpp:50:29: warning: unused parameter 'n' [-Wunused-parameter]
         void increment_size(int n)
                                 ^
    /usr/bin/g++-5 -o ./debug/VectorList @"VectorList.txt" -L.
    make[1]: Leaving directory `experimental/VectorList'
    ====2 errors, 2 warnings====

  2. #2
    Registered User
    Join Date
    Jun 2015
    Posts
    1,643
    I see a warning -- unused parameter -- but I don't see any errors although 2 are indicated on the last line.

  3. #3
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    So I totally figured it out. My IDE was giving me an error-as-a-warning kind of thing. That's okay, I guess (it's really not T_T). But there was some commented out code there and I was trying to figure out why and I misinterpreted my compiler's output. I did figure out why code wasn't compiling correctly though. I've pushed up the changes now. I was being so silly! I was using
    Code:
    decltype(f())
    instead of
    Code:
    decltype(f(std::forward<Args>(args)...))
    I feel good now that I finally caught that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weird function call
    By ale88 in forum C Programming
    Replies: 3
    Last Post: 08-27-2011, 07:59 PM
  2. Compilation error in simple function
    By livin in forum C Programming
    Replies: 5
    Last Post: 04-17-2011, 09:07 PM
  3. compilation error on function overloading..
    By sanddune008 in forum C++ Programming
    Replies: 2
    Last Post: 07-27-2010, 10:09 AM
  4. weird compilation error
    By ladybird__86 in forum C++ Programming
    Replies: 6
    Last Post: 11-14-2009, 01:36 PM
  5. Weird template compilation error with VisualStudio 2005
    By MarkZWEERS in forum C++ Programming
    Replies: 3
    Last Post: 11-09-2008, 12:11 PM